From: Mike Ratcliffe on
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
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
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
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
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.