Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is not a JS only thing, investigate how floating point values work.


Well other languages often offer decimal, or higher precision floats, right?


Not really. Most languages don't have a built-in decimal type, it's usually just a library feature. Higher precision floats won't help you either, as adding more decimal places won't make 0.2 == 0.3, it will just make the difference between them slightly smaller.


Yes, .NET is a good example with a decimal type with:

Approximate Range -> (-7.9 x 1028 to 7.9 x 1028) / (100 to 28)

Precision -> 28-29 significant digits

https://msdn.microsoft.com/en-us/library/364x0z75.aspx


right, but I think he first needs some insight on how IEEE 754 floating point arithmetic works.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: