My dart code:
main() { print("sample data"); print(700*0.002); print(7000*0.002); print(70*0.002); }
The output:
sample data 1.4000000000000001 14.0 0.14
Why the output is different in case of 700? How to fix that?
This is floating-point aliasing due to their IEEE 754 representation and not unique to dart
Python:
>>> 700*0.002 1.4000000000000001
Just display them with something float-aware and the precision will be right or move your math into an integer space