LOG10E mystery constant

Mark S. Miller erights at google.com
Sun Feb 20 21:47:20 PST 2011


On Sun, Feb 20, 2011 at 9:26 PM, John Cowan <cowan at mercury.ccil.org> wrote:

> Mark S. Miller scripsit:
>
> > This is the only constant whose actual value differs across browsers:
> >
> > 0.43429448190325176   v8 version 2.3.9 [console: dumb]
> > 0.4342944819032518     Chrome 11.0.672.2 dev
>
> [etc.]
>
> The two values are really the same value when represented as an IEEE
> double.  The difference is in the printing routine, not the internal
> representation.  Specifically, the "...2518" browsers are rounding, the
> "...25176" browsers are not.
>

But they convert to back to two different floating point numbers, at least
on all the browsers I quickly tried.

> 0.43429448190325176 === 0.4342944819032518
false
> 0.43429448190325176 < 0.4342944819032518
true
> 0.43429448190325176 > 0.4342944819032518
false

A little more testing reveals that the two numbers seem to be consecutive,
in the sense that there are no intermediate representable numbers.


>
> "Floating-point numbers are a little like sandpiles; every time you pick
> one up, you get a little less sand and a little more dirt."  (But this
> is not true of integers up to 2^53, slightly less than 10^16.
>
> --
> John Cowan                                <cowan at ccil.org>
> Yakka foob mog.  Grug pubbawup zink wattoom gazork.  Chumble spuzz.
>    --Calvin, giving Newton's First Law "in his own words"
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110220/9a37401e/attachment.html>


More information about the es-discuss mailing list