You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dart allows for arbitrary precision integers, while JavaScript has a max. Code that works in the VM will not work in JavaScript. This will be a surprise to many developers.
Example:
var bigInt = 346538465234590347592847298346243459756895347698465298346583746592374652378462347569234765834765947569827346583465243765923847659234765928347659567398475647495873984572947593470294387093493456870849216348723763945678236420938467345762304958724596873045876234572037862934765294365243652548673456705673465273465246734506873456729457623845623456234650457693475603768922346728346256;
print(bigInt); // correct in Dart VM, Infinity in JavaScript
The code from Frog:
var bigInt = (346538465234590347592847298346243459756895347698465298346583746592374652378462347569234765834765947569827346583465243765923847659234765928347659567398475647495873984572947593470294387093493456870849216348723763945678236420938467345762304958724596873045876234572037862934765294365243652548673456705673465273465246734506873456729457623845623456234650457693475603768922346728346256);
print(bigInt);
How do we handle differences like this, and communicate it to the developer?
The text was updated successfully, but these errors were encountered:
Dart allows for arbitrary precision integers, while JavaScript has a max. Code that works in the VM will not work in JavaScript. This will be a surprise to many developers.
Example:
var bigInt = 346538465234590347592847298346243459756895347698465298346583746592374652378462347569234765834765947569827346583465243765923847659234765928347659567398475647495873984572947593470294387093493456870849216348723763945678236420938467345762304958724596873045876234572037862934765294365243652548673456705673465273465246734506873456729457623845623456234650457693475603768922346728346256;
print(bigInt); // correct in Dart VM, Infinity in JavaScript
The code from Frog:
var bigInt = (346538465234590347592847298346243459756895347698465298346583746592374652378462347569234765834765947569827346583465243765923847659234765928347659567398475647495873984572947593470294387093493456870849216348723763945678236420938467345762304958724596873045876234572037862934765294365243652548673456705673465273465246734506873456729457623845623456234650457693475603768922346728346256);
print(bigInt);
How do we handle differences like this, and communicate it to the developer?
The text was updated successfully, but these errors were encountered: