Skip to content

Instantly share code, notes, and snippets.

@jpedrosa
Created November 29, 2011 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpedrosa/1406519 to your computer and use it in GitHub Desktop.
Save jpedrosa/1406519 to your computer and use it in GitHub Desktop.
$ cat big_what.dart
main() {
print(0xABADC0DA * 0xABADC0DA);
//= 8296076440540789000 (doubles, javascript)
//#= 8296076440540789156 (bigints)
}
$ dart_release big_what.dart
8296076440540789156
$ frogsh big_what.dart
2001308926266292700
$ node obig.dart.app.js
8296076440540789000
$ frogsh --compile-only --out=big_what.js big_what.dart
$ node big_what.js
2001308926266292700
$ cat big_what.js
// ********** Library dart:core **************
// ********** Natives dart:core **************
// ********** Code for Object **************
// ********** Code for BadNumberFormatException **************
function BadNumberFormatException() {}
BadNumberFormatException.prototype.toString = function() {
return ("BadNumberFormatException: '" + this._s + "'");
}
// ********** Code for top level **************
function print(obj) {
if (typeof console == 'object') {
if (obj) obj = obj.toString();
console.log(obj);
} else {
write(obj);
write('\n');
}
}
// ********** Library dart:coreimpl **************
// ********** Code for NumImplementation **************
NumImplementation = Number;
// ********** Code for StringImplementation **************
StringImplementation = String;
StringImplementation.prototype.contains = function(pattern, startIndex) {
return this.indexOf(pattern, startIndex) >= 0;
}
// ********** Code for top level **************
// ********** Library big_what **************
// ********** Code for top level **************
function main() {
print(2001308926266292700/*0xABADC0DA * 0xABADC0DA*/);
}
main();
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment