tsitixe
tsitixe

Reputation: 2351

flutter dart bigint vs num/double

I got a simple question here with dart-flutter [:

BigInt is really helpful when we deal with large ints. But when we type BigNum or BigDouble, errors are displayed. So, here comes the question.

Is it safe to use large num or double in dart-flutter? When we try to do something with BigInt variable using int(not BigInt) methods, it actually doesn't work. So i wonder if those hazardous ideas could be raised even when we use double or num which is really large enough to be considered in context of BigInt class.

Hope some dart-flutter guru would give a cool answer for this question! Thanks in advance [:

Upvotes: 1

Views: 1900

Answers (1)

Erfan Eghterafi
Erfan Eghterafi

Reputation: 5635

For decimal numbers please use Decimal package

//normal division
print((0.5 / 894654).toString()); //5.588752746871976e-7

//using Decimal package
print(Decimal.pars((0.5 / 894654).toString())); // 0.0000005588752746871976

Upvotes: 1

Related Questions