From: Dr J R Stockton on 12 Aug 2010 14:32 In comp.lang.javascript message <e569280f-ff26-4817-b5b8-c12ecf98107b(a)q2 2g2000yqm.googlegroups.com>, Wed, 11 Aug 2010 10:59:23, Mike Ratcliffe <michael(a)ratcliffefamily.org> posted: >I realize that numeric accuracy is not perfect in JS but from what I >have read in the FAQ etc. it seems that the number 632769996261406250 >should be easily handled by JavaScript. > >The following: >alert(632769996261406250) > >Displays 632769996261406200 ... does anybody know why? Yes. Convert your number to binary, getting +100011001000000011001111010110000011101011111011011000101010 which is 60 bits long. Disregard trailing zeroes, and you have 59 bits of resolution; a JavaScript Number, which is an IEEE Double, can hold only 53 significant bits of resolution. More about Numbers, etc., via sig below. -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE8 FF3 Op10 Sf4 Cr4 news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>. <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
First
|
Prev
|
Pages: 1 2 Prev: preferred way of handling events Next: Last CFP - Applied Computing 2010: 3 September 2010 |