From: Mike Ratcliffe on 11 Aug 2010 13:59 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?
From: Richard Cornford on 11 Aug 2010 14:11 On Aug 11, 6:59 pm, Mike Ratcliffe <mich...(a)ratcliffefamily.org> wrote: > 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? With IEEE double precision floating point numbers the range of precisely representable positive integers goes up to 2 to the power of 53 (i.e. 9007199254740992), beyond that some integers must be represented as approximations, and your number is beyond that. Richard.
From: RobG on 11 Aug 2010 20:54 On Aug 12, 3:59 am, Mike Ratcliffe <mich...(a)ratcliffefamily.org> wrote: > 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? Richard gave you the precise answer, a rule of thumb is that integers longer than 15 digits may be approximated. -- Rob
From: Mike Ratcliffe on 12 Aug 2010 03:15 On 12 Aug, 02:54, RobG <rg...(a)iinet.net.au> wrote: > On Aug 12, 3:59 am, Mike Ratcliffe <mich...(a)ratcliffefamily.org> > wrote: > > > 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? > > Richard gave you the precise answer, a rule of thumb is that integers > longer than 15 digits may be approximated. > > -- > Rob Integers longer than 15 digits eh? I learn something new every day. Thanks guys.
From: Ry Nohryb on 12 Aug 2010 03:47 On Aug 12, 2:54 am, RobG <rg...(a)iinet.net.au> wrote: > > a rule of thumb is that integers > longer than 15 digits may be approximated. That's so true that the probability of that "may be" is almost 1... :-) -- Jorge.
|
Next
|
Last
Pages: 1 2 Prev: preferred way of handling events Next: Last CFP - Applied Computing 2010: 3 September 2010 |