Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #41110

Re: Are Floating Point Numbers still a Can of Worms?

Path csiph.com!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Mostowski Collapse <janburse@fastmail.fm>
Newsgroups comp.lang.javascript
Subject Re: Are Floating Point Numbers still a Can of Worms?
Date Sat, 15 Oct 2022 18:51:56 +0200
Message-ID <tieofb$av1b$1@solani.org> (permalink)
References <31753076-4806-4dd3-8577-40a4ed23b57dn@googlegroups.com> <tie8s2$am5d$1@solani.org> <tieg7a$5h9$1@gioia.aioe.org> <tiej7q$2pf9o$2@dont-email.me> <87h705nke7.fsf@bsb.me.uk> <c6e54aaa-618b-4a5d-9c0e-3c074880d356n@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sat, 15 Oct 2022 16:51:55 -0000 (UTC)
Injection-Info solani.org; logging-data="359467"; mail-complaints-to="abuse@news.solani.org"
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0 SeaMonkey/2.53.14
Cancel-Lock sha1:pVtABzLoaZI/fAsf5ElcRi4IBsU=
In-Reply-To <c6e54aaa-618b-4a5d-9c0e-3c074880d356n@googlegroups.com>
X-User-ID eJwFwQERADEIAzBLQGk35Dzj8C/hE0Kud1JUcrlN29OukDluV45HQTWEnQsrJrL1cgeab9xiuzCgsybjBxyMFA8=
Xref csiph.com comp.lang.javascript:41110

Show key headers only | View raw


Versions used, both 64-bit on Windows 10:

Chrome 106.0.5249.119
Firefox 105.0.3

Mostowski Collapse schrieb:
> I wonder whether FireFox always yields the more
> accurate values, or whether this is just one example.
> 
> Here are some more failures of Chrome,
> accuracy of B**E:
> 
> B = 1889, E = 29;
> B = 1470, E = 56;
> B = -1976, E = -49;
> B = 3240, E = -18;
> B = 2154, E = -6;
> B = -182, E = -32;
> B = 852, E = 43;
> B = 3316, E = -37;
> B = 2830, E = 25;
> B = 4075, E = -29;
> B = -2128, E = 64;
> 
> On the other hand Firefox fails here, BTW Python
> fails also here, JDK 19 gives a different result:
> 
> B = 396, E = -1;
> 
> LoL
> 
> Ben Bacarisse schrieb am Samstag, 15. Oktober 2022 um 18:04:24 UTC+2:
>> John Harris <ni...@jghnorth.org.uk.invalid> writes:
>>
>>> On 15/10/2022 15:31, R.Wieser wrote:
>>>
>>> <snip>
>>>> P.s.
>>>> I've got some numbers for you :
>>>> -- 1889*1889*1889*1889*1889* etc. calculated thru the FPU
>>>> 53A891D176398773 - 1.0250068783051204e+095
>>> <snip>
>>>
>>> For what it's worth, the correct value of 1889**29 is :
>>>
>>> 102500687830512064253064716070601123218909116358654017979384519544555980744900395407329380298209
>>>
>>> so the ...206 value is most accurate and ...207 is only slightly less
>>> accurate.
>> True. But neither 1.0250068783051206e95 nor 1.0250068783051207e95 can
>> be represented in binary floating point. The two representable
>> numbers closest to 1889**29 are
>>
>> 1025006878305120[5]6620692472528153354473784341513556365963141787204703693721957646169653433597952
>>
>> and
>>
>> 1025006878305120[7]1442079894904626368690870422625608571181699824406695890772528399182534027509760
>>
>> So the larger of the two is, in fact, the more accurate. There are two
>> kinds of accuracy at this level: (1) what binary floating point number
>> is the closest and, (2) what decimal is the closest representation to
>> /that/ binary number?
>>
>> -- 
>> Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <bursejan@gmail.com> - 2022-10-14 15:52 -0700
  Re: Are Floating Point Numbers still a Can of Worms? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-15 01:52 +0100
  Re: Are Floating Point Numbers still a Can of Worms? "R.Wieser" <address@not.available> - 2022-10-15 09:33 +0200
    Re: Are Floating Point Numbers still a Can of Worms? "R.Wieser" <address@not.available> - 2022-10-15 10:00 +0200
    Re: Are Floating Point Numbers still a Can of Worms? John Harris <niam@jghnorth.org.uk.invalid> - 2022-10-15 11:13 +0100
      Re: Are Floating Point Numbers still a Can of Worms? "R.Wieser" <address@not.available> - 2022-10-15 13:43 +0200
        Re: Are Floating Point Numbers still a Can of Worms? John Harris <niam@jghnorth.org.uk.invalid> - 2022-10-15 15:56 +0100
          Re: Are Floating Point Numbers still a Can of Worms? "R.Wieser" <address@not.available> - 2022-10-15 17:44 +0200
  Re: Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <janburse@fastmail.fm> - 2022-10-15 14:25 +0200
    Re: Are Floating Point Numbers still a Can of Worms? "R.Wieser" <address@not.available> - 2022-10-15 16:31 +0200
      Re: Are Floating Point Numbers still a Can of Worms? John Harris <niam@jghnorth.org.uk.invalid> - 2022-10-15 16:22 +0100
        Re: Are Floating Point Numbers still a Can of Worms? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-15 17:04 +0100
          Re: Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <bursejan@gmail.com> - 2022-10-15 09:47 -0700
            Re: Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <janburse@fastmail.fm> - 2022-10-15 18:51 +0200
              Re: Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <bursejan@gmail.com> - 2022-10-22 14:35 -0700
                Re: Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <bursejan@gmail.com> - 2022-11-21 09:02 -0800
  Re: Are Floating Point Numbers still a Can of Worms? Julio Di Egidio <julio@diegidio.name> - 2022-10-17 02:00 -0700
    Re: Are Floating Point Numbers still a Can of Worms? Mostowski Collapse <bursejan@gmail.com> - 2022-10-18 07:40 -0700

csiph-web