DEV Community

loading...

100 Bytes Of Wisdom: Day 39

samjarman profile image Sam Jarman 👨🏼‍💻 ・1 min read

Alt Text

Always work in the smallest unit possible, eg milliseconds, cents, meters. You can always divide to something reasonable when it comes time to display the value, such as dollars. Computers really suck at storing floating points number, so using whole numbers is usually best.

Heads up: As with any terse bit of advice, there will be exceptions of course, and subtleties and nuance that can't possibly be captured in a Byte of Wisdom. This has been what I've experienced, I'd love to hear yours in the comments too!

You can catch up with all the other bytes at http://bytesofwisdom.com/

Discussion (0)

pic
Editor guide