I do this operation and I want result without exponents :
main(){
var result = ((1.1+2)+3.14+4+(5+6+7)+(8+9+10)*4267387833344334647677634)/2*553344300034334349999000;
print(result); // With exponent
print(result.toInt()); // Full number ?
}
And it print
3.18780189038289e+49
31878018903828901761984975061078744643351263313920
But the toInt() result is wrong, the good result is 31878018903828899277492024491376690701584023926880 . It check it with groovy (web) console.
How can I do to have my int full number ?
As in
resultthere aredoubleliterals, theresulttype isdouble.In Dart a
doubleis a :This is why you lose precision.
You can see the lost of precision with the following code :
This lost of precision is not specific to Dart, for instance
31878018903828899277492024491376690701584023926880.0and31878018903828901761984975061078744643351263313920.0are equal in Java.The groovy web console gives you the right result because AFAICT groovy literals with decimal points are instantiated as java.math.BigDecimal by default.
Finally there is an open issue on Decimal data type you can star and until decimals are natively supported, you can use my decimal package;