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

The proper tldr is - understand how floating point works (you can represent a huge range of numbers with a lot of precision, but not perfect accuracy, and high performance), and then decide if it is the proper data type for your problem. For example setting the heading and velocity of a missile (85.623 degrees, 500.138 m/s (idk how fast missiles go) floats are great. It is impossible to steer on an exact course anyway due to wind, temperature, etc (I assume...)

Storing the number of dollars in you savings account - us decimal or better yet integer (just count the pennies).



IEEE 64 bit double can represent a missile velocity of 85.6230000000000.




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

Search: