459,250 Members | 1,631 Online
Need help? Post your question and get tips & solutions from a community of 459,250 IT Pros & Developers. It's quick & easy.

# FAQ Topic - Why does 5 * 1.015 != 5.075 or 0.06+0.01 != 0.07?

 P: n/a ----------------------------------------------------------------------- FAQ Topic - Why does 5 * 1.015 != 5.075 or 0.06+0.01 != 0.07? ----------------------------------------------------------------------- Javascript numbers are represented in binary as IEEE-754 (IEC 559) Doubles, with a resolution of 53 bits, giving an accuracy of 15-16 decimal digits; integers up to about 9e15 are precise, but few decimal fractions are. Given this, arithmetic is as exact as possible, but no more. Operations on integers are exact if the true result and all intermediates are integers within that range. In particular, non-integer results should not normally be compared for equality; and non-integer computed results generally need rounding; see 4.6. http://msdn.microsoft.com/library/de...6dbf483b41.asp === Postings such as this are automatically sent once a day. Their goal is to answer repeated questions, and to offer the content to the community for continuous evaluation/improvement. The complete comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html. The FAQ workers are a group of volunteers. Jun 14 '07 #1