Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Quod licet Iovi non licet bovi. (What Jove may do, is not permitted to a cow.)


devel / comp.arch / Re: Radians Or Degrees?

SubjectAuthor
* Re: Radians Or Degrees?Michael S
+* Re: Radians Or Degrees?MitchAlsup1
|`* Re: Radians Or Degrees?Steven G. Kargl
| +* Re: Radians Or Degrees?Chris M. Thomasson
| |`* Re: Radians Or Degrees?Chris M. Thomasson
| | `* Re: Radians Or Degrees?MitchAlsup1
| |  `- Re: Radians Or Degrees?Chris M. Thomasson
| +* Re: Radians Or Degrees?MitchAlsup1
| |`* Re: Radians Or Degrees?Terje Mathisen
| | `* Re: Radians Or Degrees?Michael S
| |  +* Re: Radians Or Degrees?MitchAlsup1
| |  |+* Re: Radians Or Degrees?MitchAlsup1
| |  ||`- Re: Radians Or Degrees?Terje Mathisen
| |  |+* Re: Radians Or Degrees?Lawrence D'Oliveiro
| |  ||+- Re: Radians Or Degrees?Chris M. Thomasson
| |  ||`* Re: Radians Or Degrees?MitchAlsup1
| |  || `* Re: Radians Or Degrees?Chris M. Thomasson
| |  ||  `- Re: Radians Or Degrees?Chris M. Thomasson
| |  |`- Re: Radians Or Degrees?Michael S
| |  +* Re: Radians Or Degrees?Terje Mathisen
| |  |+* Re: Radians Or Degrees?Michael S
| |  ||`* Re: Radians Or Degrees?MitchAlsup1
| |  || `- Re: Radians Or Degrees?Terje Mathisen
| |  |`* Re: Radians Or Degrees?Chris M. Thomasson
| |  | +* Re: Radians Or Degrees?Chris M. Thomasson
| |  | |`- Re: Radians Or Degrees?Chris M. Thomasson
| |  | +* Re: Radians Or Degrees?Keith Thompson
| |  | |+* Re: Radians Or Degrees?Chris M. Thomasson
| |  | ||`* Re: Radians Or Degrees?Chris M. Thomasson
| |  | || `* Re: Radians Or Degrees?Keith Thompson
| |  | ||  `* Re: Radians Or Degrees?Chris M. Thomasson
| |  | ||   `- Re: Radians Or Degrees?Chris M. Thomasson
| |  | |`* Re: Radians Or Degrees?MitchAlsup1
| |  | | `* Re: Radians Or Degrees?Michael S
| |  | |  `* Re: Radians Or Degrees?MitchAlsup1
| |  | |   +- Re: Radians Or Degrees?Scott Lurndal
| |  | |   +- Re: Radians Or Degrees?Michael S
| |  | |   `* Re: Radians Or Degrees?Keith Thompson
| |  | |    +* Re: Radians Or Degrees?bart
| |  | |    |`* Re: Radians Or Degrees?Keith Thompson
| |  | |    | `* Re: Radians Or Degrees?bart
| |  | |    |  `* Re: Radians Or Degrees?Keith Thompson
| |  | |    |   `- Re: Radians Or Degrees?David Brown
| |  | |    `* Re: Radians Or Degrees?Michael S
| |  | |     `- Re: Radians Or Degrees?Michael S
| |  | `- Re: Radians Or Degrees?Chris M. Thomasson
| |  `* Re: Radians Or Degrees?Stefan Monnier
| |   `* Re: Radians Or Degrees?MitchAlsup1
| |    `* Re: Radians Or Degrees?Stefan Monnier
| |     +* Re: Radians Or Degrees?Michael S
| |     |+* Re: Radians Or Degrees?Stefan Monnier
| |     ||`* Re: Radians Or Degrees?MitchAlsup1
| |     || `* Re: Radians Or Degrees?Terje Mathisen
| |     ||  `* Re: Radians Or Degrees?Michael S
| |     ||   +- Re: Radians Or Degrees?MitchAlsup1
| |     ||   `- Re: Radians Or Degrees?Terje Mathisen
| |     |+* Re: Radians Or Degrees?Steven G. Kargl
| |     ||`- Re: Radians Or Degrees?MitchAlsup1
| |     |`* Re: Radians Or Degrees?MitchAlsup1
| |     | `- Re: Radians Or Degrees?Michael S
| |     +* Re: Radians Or Degrees?MitchAlsup1
| |     |`- Re: Radians Or Degrees?Stefan Monnier
| |     `- Re: Radians Or Degrees?Terje Mathisen
| `* Re: Radians Or Degrees?Michael S
|  `* Re: Radians Or Degrees?MitchAlsup1
|   `* Re: Radians Or Degrees?Steven G. Kargl
|    +* Re: Radians Or Degrees?MitchAlsup1
|    |+* Re: Radians Or Degrees?Lawrence D'Oliveiro
|    ||`* Re: Radians Or Degrees?Steven G. Kargl
|    || +* Re: Radians Or Degrees?Lawrence D'Oliveiro
|    || |`* Re: Radians Or Degrees?Steven G. Kargl
|    || | `- Re: Radians Or Degrees?Kaz Kylheku
|    || `* Re: Radians Or Degrees?Lawrence D'Oliveiro
|    ||  `* Re: Radians Or Degrees?Steven G. Kargl
|    ||   `- Re: Radians Or Degrees?MitchAlsup1
|    |`- Re: Radians Or Degrees?Steven G. Kargl
|    `* Re: Radians Or Degrees?Terje Mathisen
|     `- Re: Radians Or Degrees?MitchAlsup1
`* Re: Radians Or Degrees?Terje Mathisen
 `* Re: Radians Or Degrees?Michael S
  +* Re: Radians Or Degrees?Terje Mathisen
  |`* Re: Radians Or Degrees?MitchAlsup1
  | +* Re: Radians Or Degrees?Chris M. Thomasson
  | |`* Re: Radians Or Degrees?MitchAlsup1
  | | `- Re: Radians Or Degrees?Chris M. Thomasson
  | `* Re: Radians Or Degrees?Terje Mathisen
  |  `- Re: Radians Or Degrees?George Neuner
  `- Re: Radians Or Degrees?MitchAlsup1

Pages:1234
Re: Radians Or Degrees?

<ut2el2$2ffnh$3@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38070&group=comp.arch#38070

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Fri, 15 Mar 2024 14:30:09 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <ut2el2$2ffnh$3@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com> <ut2ef1$2ffnh$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Mar 2024 21:30:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ed612d4ce44e1af227fa0b762e20f588";
logging-data="2604785"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tPgHAEAP7zcetFM4waXZ+YgcBQFqRyfs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wJwBpJiMKOOAojl9RF+FsvHWW4c=
Content-Language: en-US
In-Reply-To: <ut2ef1$2ffnh$2@dont-email.me>
 by: Chris M. Thomasson - Fri, 15 Mar 2024 21:30 UTC

On 3/15/2024 2:26 PM, Chris M. Thomasson wrote:
[...]
> Notice how the numbers are small? However, if we zoom in enough, then
> 2^53 might become an issue..
[...]

Argh! I mean if we zoom in enough, then only 2^53 of precision might
become an issue... We can go in really deep:

A deep zoom might be 10^275. Somebody did one to the 10^4141! I feel
like including a youtube link here, but I will refrain out of respect
for you.

Re: Radians Or Degrees?

<ut2h6p$2g9l4$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38072&group=comp.arch#38072

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!rocksolid2!i2pn.org!nntp.comgw.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Fri, 15 Mar 2024 15:13:44 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <ut2h6p$2g9l4$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Mar 2024 22:13:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ed612d4ce44e1af227fa0b762e20f588";
logging-data="2631332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xwpGX2JXTdCXchrw34uoiOTv/9EqLXkg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Qb9Nnhi/ygM9oixcHMk87nTGwO0=
Content-Language: en-US
In-Reply-To: <ut2csb$2fe4u$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 15 Mar 2024 22:13 UTC

On 3/15/2024 1:59 PM, Chris M. Thomasson wrote:
> On 3/15/2024 3:23 AM, Terje Mathisen wrote:
>> Michael, I for the main part agree with you here, i.e. calculating
>> sin(x) with x larger than 2^53 or so, is almost certainly stupid.
> [...]
>
> ;^D tooooooo big. :^)

Actually, I can think of one of my fractals that tries to scale back
numbers that get too big.

https://www.shadertoy.com/view/XtscDl

When a complex number breaches an escape time barrier, my code simply
scales it back, say z = z * .242, and tries the fractal again. It has
the effect of exploding the fractal out beyond its original boundaries...

>
> Now, wrt the results, arbitrary precision for trig is useful, in say...
> Deep fractal zooms...
>
> Zooming in really deep in say something like this, well the precision of
> trig can become an issue:
>
> https://paulbourke.net/fractals/multijulia/
>
> Trig would be used, say, in rectangular to-from polar forms wrt getting
> the n-ary roots of a complex number?
>

Re: Radians Or Degrees?

<87sf0r2jso.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38073&group=comp.arch#38073

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Fri, 15 Mar 2024 15:48:39 -0700
Organization: None to speak of
Lines: 22
Message-ID: <87sf0r2jso.fsf@nosuchdomain.example.com>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<ut2ef1$2ffnh$2@dont-email.me> <ut2el2$2ffnh$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1424ef631298fc5a748d3d307144615d";
logging-data="2646135"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7N7CCHZ9hKoUVFsLU1W5L"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:4QSSQOroOCM+FJujkovzKPvD/KM=
sha1:PL+Z7Pmk1YY5u51cot7y2dhHafA=
 by: Keith Thompson - Fri, 15 Mar 2024 22:48 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
> On 3/15/2024 2:26 PM, Chris M. Thomasson wrote:
> [...]
>> Notice how the numbers are small? However, if we zoom in enough,
>> then 2^53 might become an issue..
> [...]
>
> Argh! I mean if we zoom in enough, then only 2^53 of precision might
> become an issue... We can go in really deep:
>
> A deep zoom might be 10^275. Somebody did one to the 10^4141! I feel
> like including a youtube link here, but I will refrain out of respect
> for you.

I don't object to YouTube links as long as they're reasonably relevant
and there's enough information for readers to decide whether it's worth
their time to open them.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Radians Or Degrees?

<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38074&group=comp.arch#38074

  copy link   Newsgroups: comp.lang.c comp.arch
Date: Sat, 16 Mar 2024 01:16:25 +0000
Subject: Re: Radians Or Degrees?
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.lang.c,comp.arch
X-Rslight-Site: $2y$10$310n.w2K3G9qDGqK3L21YO0MaJTzWw7OOjHmtQvY0GifTLF23ebXO
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me> <20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me> <ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com> <3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org> <ur8nud$4n1r$1@dont-email.me> <936a852388e7e4414cb7e529da7095ea@www.novabbs.org> <ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com> <ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me> <87wmq32o26.fsf@nosuchdomain.example.com>
Organization: Rocksolid Light
Message-ID: <8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
 by: MitchAlsup1 - Sat, 16 Mar 2024 01:16 UTC

Keith Thompson wrote:

> I can see how computing sin(x) with high precision for "reasonable"
> values of x would be useful, but does any of that benefit from being
> able to compute sin(2^53) accurately?

Because accurate argument reduction reduces the burden on the programmer
to remain within his sandbox. Since early 1990s, when Payne and Hanek
argument reduction became widely available, there is no reason NOT to
perform argument reduction with great accuracy. NOTE: you don't HAVE to
use Payne and Hanek when simpler strategies word adequately; but when
they do not, you do not have to "Throw up your hands" and run away.

Re: Radians Or Degrees?

<55fdf9ae69cdafb285b26afba62f7d46@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38075&group=comp.arch#38075

  copy link   Newsgroups: comp.lang.c comp.arch
Date: Sat, 16 Mar 2024 01:23:12 +0000
Subject: Re: Radians Or Degrees?
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.lang.c,comp.arch
X-Rslight-Site: $2y$10$phv1M6hH8aB5zw/UxKQT8uYy4EpU2wzKMnnIh/k4veJ5eoJSuyLrS
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me> <20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me> <ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com> <3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org> <ur8nud$4n1r$1@dont-email.me> <936a852388e7e4414cb7e529da7095ea@www.novabbs.org> <ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com> <ut17ji$27n6b$1@dont-email.me> <20240315141552.00003d38@yahoo.com>
Organization: Rocksolid Light
Message-ID: <55fdf9ae69cdafb285b26afba62f7d46@www.novabbs.org>
 by: MitchAlsup1 - Sat, 16 Mar 2024 01:23 UTC

Michael S wrote:

> To make it less tempting, you could try to push for inclusion of
> rsqrt() into basic set. Long overdue, IMHO.

Many Newton-Raphson iterations converge more rapidly with RSQRT than
with SQRT, for reasons I never looked that deeply into.

> Right now, I can't think of any other transcendental that I really want
> to elevate to higher status. It seems to me that elevation of log2(x)
> and of 2**x will do no harm, but I am not sure about usefulness.

Ln2 and EXP2 are the basis of My 66000 log and EXP families, performed in
HW function unit.

Ln2 has the property that a binade [1..2) maps directly to another binade
[2..4); exp2 has a similar property. Ln2 is easier to get good accuracy
from than Ln or Log as a starting point. But in any event:: you are always
within a high precision multiply of the correct result = round(53×106);

Re: Radians Or Degrees?

<ut4fkn$2vfdf$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38077&group=comp.arch#38077

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: terje.mathisen@tmsw.no (Terje Mathisen)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 16:59:19 +0100
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <ut4fkn$2vfdf$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <20240315141552.00003d38@yahoo.com>
<55fdf9ae69cdafb285b26afba62f7d46@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Date: Sat, 16 Mar 2024 15:59:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="65957274c0a537e7b6abe814e4c6dd59";
logging-data="3128751"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+q117+749g2nr/5JnrYC+EbpEw1diPQytAom31TrJbA=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:15v90xNtYAs5yz4flLfLaG9fVwE=
In-Reply-To: <55fdf9ae69cdafb285b26afba62f7d46@www.novabbs.org>
 by: Terje Mathisen - Sat, 16 Mar 2024 15:59 UTC

MitchAlsup1 wrote:
> Michael S wrote:
>
>> To make it less tempting, you could try to push for inclusion of
>> rsqrt() into basic set. Long overdue, IMHO.
>
> Many Newton-Raphson iterations converge more rapidly with RSQRT than
> with SQRT, for reasons I never looked that deeply into.

The classic NR iteration for rsqrt() uses only fmul & fadd/fsub, while
the naive sqrt() version needs a divide in every iteration.

Personally I prefer to use the y = rsqrt(x) form and then just multiply
by x in the end:

y = sqrt(x) = x/sqrt(x) = rsqrt(x)*x

In order to get the rounding correct from this form you can probably
just square the final result and compare this with the original input?
>
>> Right now, I can't think of any other transcendental that I really want
>> to elevate to higher status. It seems to me that elevation of log2(x)
>> and of 2**x will do no harm, but I am not sure about usefulness.
>
> Ln2 and EXP2 are the basis of My 66000 log and EXP families, performed in
> HW function unit.
>
> Ln2 has the property that a binade [1..2) maps directly to another binade
> [2..4); exp2 has a similar property. Ln2 is easier to get good accuracy
> from than Ln or Log as a starting point. But in any event:: you are
> always within a high precision multiply of the correct result =
> round(53×106);

Exactly the same reasoning I used to compute rsqrt() over the [1.0 -
4.0> range, or (simplifying the exp logic) over [0.5 - 2.0> so that the
last exp bit maps to the first vs second half of the range. Back before
we got approximate rsqrt() lookup opcodes, I wrote code that took the
last exp bit and the first n mantissa bits and looked up an optimal
starting point for that value + 0.5 ulp. Getting 11-12 bits this way
means approximatly correct float after a single iteration and useful
double after two.

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: Radians Or Degrees?

<20240316190815.000005a2@yahoo.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38078&group=comp.arch#38078

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5chosen@yahoo.com (Michael S)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 19:08:15 +0200
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <20240316190815.000005a2@yahoo.com>
References: <ur5trn$3d64t$1@dont-email.me>
<ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me>
<20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me>
<ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="a0fcde4220d3b0b85ffd2f3c1c6e979a";
logging-data="3153645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XmtKXQTgwddhsChOyABYzP/RnmlEjC6M="
Cancel-Lock: sha1:nxMR9+A1nyjGZaSjgf+U+iv1xWY=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Sat, 16 Mar 2024 17:08 UTC

On Sat, 16 Mar 2024 01:16:25 +0000
mitchalsup@aol.com (MitchAlsup1) wrote:

> Keith Thompson wrote:
>
> > I can see how computing sin(x) with high precision for "reasonable"
> > values of x would be useful, but does any of that benefit from being
> > able to compute sin(2^53) accurately?
>
> Because accurate argument reduction reduces the burden on the
> programmer to remain within his sandbox.

Not really.
sin(2**53) is not what programmer wanted, because 2**53 is not the x he
really wanted. It has nothing to do with calculation of sin().

> Since early 1990s, when
> Payne and Hanek argument reduction became widely available, there is
> no reason NOT to perform argument reduction with great accuracy.
> NOTE: you don't HAVE to use Payne and Hanek when simpler strategies
> word adequately; but when they do not, you do not have to "Throw up
> your hands" and run away.

Re: Radians Or Degrees?

<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38079&group=comp.arch#38079

  copy link   Newsgroups: comp.lang.c comp.arch
Date: Sat, 16 Mar 2024 17:22:50 +0000
Subject: Re: Radians Or Degrees?
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.lang.c,comp.arch
X-Rslight-Site: $2y$10$GF.gpwicJ40aC8.AkrPZQuZo21CnkW9tGkAz6CxiJxFrx5bH6NO3q
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me> <20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me> <ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com> <3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org> <ur8nud$4n1r$1@dont-email.me> <936a852388e7e4414cb7e529da7095ea@www.novabbs.org> <ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com> <ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me> <87wmq32o26.fsf@nosuchdomain.example.com> <8de6385435bbdb0695a7ff213653f345@www.novabbs.org> <20240316190815.000005a2@yahoo.com>
Organization: Rocksolid Light
Message-ID: <dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
 by: MitchAlsup1 - Sat, 16 Mar 2024 17:22 UTC

Michael S wrote:

> On Sat, 16 Mar 2024 01:16:25 +0000
> mitchalsup@aol.com (MitchAlsup1) wrote:

>> Keith Thompson wrote:
>>
>> > I can see how computing sin(x) with high precision for "reasonable"
>> > values of x would be useful, but does any of that benefit from being
>> > able to compute sin(2^53) accurately?
>>
>> Because accurate argument reduction reduces the burden on the
>> programmer to remain within his sandbox.

> Not really.

Say you are a programmer and you receive a value like 2^53 from an
Input read and you wan the most accurate possible SIN( of that ).

With high precision argument reduction you have to do (wait for it)
NoThInG !!.

Without high precision argument reduction yo have to do a lot of
programming--programming that I insist should have been done by
the programmer responsible for sin(x).

> sin(2**53) is not what programmer wanted, because 2**53 is not the x he
> really wanted. It has nothing to do with calculation of sin().

And EvErYtHiNg to do with high precision argument reduction; and
maybe the programmer has no requirement on what he is allowed to
read in from a file and pass onto sin(x).

>> Since early 1990s, when
>> Payne and Hanek argument reduction became widely available, there is
>> no reason NOT to perform argument reduction with great accuracy.
>> NOTE: you don't HAVE to use Payne and Hanek when simpler strategies
>> word adequately; but when they do not, you do not have to "Throw up
>> your hands" and run away.

Re: Radians Or Degrees?

<oBlJN.86079$Wbff.20771@fx37.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38080&group=comp.arch#38080

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx37.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Radians Or Degrees?
Newsgroups: comp.lang.c,comp.arch
References: <ur5trn$3d64t$1@dont-email.me> <3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org> <ur8nud$4n1r$1@dont-email.me> <936a852388e7e4414cb7e529da7095ea@www.novabbs.org> <ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com> <ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me> <87wmq32o26.fsf@nosuchdomain.example.com> <8de6385435bbdb0695a7ff213653f345@www.novabbs.org> <20240316190815.000005a2@yahoo.com> <dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
Lines: 21
Message-ID: <oBlJN.86079$Wbff.20771@fx37.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 16 Mar 2024 18:32:52 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 16 Mar 2024 18:32:52 GMT
X-Received-Bytes: 1736
 by: Scott Lurndal - Sat, 16 Mar 2024 18:32 UTC

mitchalsup@aol.com (MitchAlsup1) writes:
>Michael S wrote:
>
>> On Sat, 16 Mar 2024 01:16:25 +0000
>> mitchalsup@aol.com (MitchAlsup1) wrote:
>
>>> Keith Thompson wrote:
>>>
>>> > I can see how computing sin(x) with high precision for "reasonable"
>>> > values of x would be useful, but does any of that benefit from being
>>> > able to compute sin(2^53) accurately?
>>>
>>> Because accurate argument reduction reduces the burden on the
>>> programmer to remain within his sandbox.
>
>> Not really.
>
>Say you are a programmer and you receive a value like 2^53 from an
>Input read and you wan the most accurate possible SIN( of that ).

That generally seems to be an highly unlikely scenario.

Re: Radians Or Degrees?

<20240316204945.00000f2b@yahoo.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38081&group=comp.arch#38081

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5chosen@yahoo.com (Michael S)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 20:49:45 +0200
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <20240316204945.00000f2b@yahoo.com>
References: <ur5trn$3d64t$1@dont-email.me>
<ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me>
<20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me>
<ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="a0fcde4220d3b0b85ffd2f3c1c6e979a";
logging-data="3153645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gqMsC2rm49MJOOyY1lG1nnFPjXXwNVcc="
Cancel-Lock: sha1:ZESg1a8lCgf/Zb2o3A9oKl1/Gxk=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Sat, 16 Mar 2024 18:49 UTC

On Sat, 16 Mar 2024 17:22:50 +0000
mitchalsup@aol.com (MitchAlsup1) wrote:

> Michael S wrote:
>
> > On Sat, 16 Mar 2024 01:16:25 +0000
> > mitchalsup@aol.com (MitchAlsup1) wrote:
>
> >> Keith Thompson wrote:
> >>
> >> > I can see how computing sin(x) with high precision for
> >> > "reasonable" values of x would be useful, but does any of that
> >> > benefit from being able to compute sin(2^53) accurately?
> >>
> >> Because accurate argument reduction reduces the burden on the
> >> programmer to remain within his sandbox.
>
> > Not really.
>
> Say you are a programmer and you receive a value like 2^53 from an
> Input read and you wan the most accurate possible SIN( of that ).
>
> With high precision argument reduction you have to do (wait for it)
> NoThInG !!.
>
> Without high precision argument reduction yo have to do a lot of
> programming--programming that I insist should have been done by
> the programmer responsible for sin(x).
>

I never met programmers that wants do anything of this sort.
Programmers that I meet in real world could sometimes want something
else. They could want, for example, to draw 1000 points of wave of blue
LED with frequency 663.42 THz (663.42e12 Hz) with step of 10 nm (1e-8 m)
starting at distance of 1 million km. Well, not really, but at least I
can imagine them wanting to do it*.
Will double precision sin() routine that does perfect argument
reduction be any more helpful for their task then sin() implementation
that makes no effort at all beyound simple modulo 2*pi? No, they both
would be the same.
May be, sinpi() that does a perfect reduction more or less by
definition, be more helpful?
For naive folks - not at all.
For advanced folks - yes, but just a little. It still wouldn't be easy.
And among programmers that I know naives outnumber advanced by more
than factor of 10.

-----
* - For more real case, they could want to draw the same wave at
distance of 2m using single-precision arithmetic.

Re: Radians Or Degrees?

<ut4v4i$32hqq$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38082&group=comp.arch#38082

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 13:23:46 -0700
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <ut4v4i$32hqq$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<ut2dl8$2ffnh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 16 Mar 2024 20:23:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ecbf074eed964d26a0e1ee52fa577a26";
logging-data="3229530"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZU4qmteMYeR4IW/mjQMX6rBi13QYhKLg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:o7ZyJODmrhlhzfjshMqt5TC9wUg=
Content-Language: en-US
In-Reply-To: <ut2dl8$2ffnh$1@dont-email.me>
 by: Chris M. Thomasson - Sat, 16 Mar 2024 20:23 UTC

On 3/15/2024 2:13 PM, Chris M. Thomasson wrote:
[...]
> three digits of decimal precision:

OOPS! I mean four:

>
> 333/106 = 3.1415_094339622641509433962264151
[...]

Re: Radians Or Degrees?

<87o7bd3guo.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38083&group=comp.arch#38083

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 16:19:11 -0700
Organization: None to speak of
Lines: 83
Message-ID: <87o7bd3guo.fsf@nosuchdomain.example.com>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="bef1352e676cdb1e0584d8972e1644aa";
logging-data="3301628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ATSOK9UXIoXPtSBDrHyVv"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:isKbIbUiNK/xLdmkYxzOKsjOUNo=
sha1:k3Q72f1Dd22mqW6v1UpoImaUtBM=
 by: Keith Thompson - Sat, 16 Mar 2024 23:19 UTC

mitchalsup@aol.com (MitchAlsup1) writes:
> Michael S wrote:
>> On Sat, 16 Mar 2024 01:16:25 +0000
>> mitchalsup@aol.com (MitchAlsup1) wrote:
>>> Keith Thompson wrote:
>>> > I can see how computing sin(x) with high precision for
>>> > "reasonable" values of x would be useful, but does any of that
>>> > benefit from being able to compute sin(2^53) accurately?
>>> Because accurate argument reduction reduces the burden on the
>>> programmer to remain within his sandbox.
>
>> Not really.
>
> Say you are a programmer and you receive a value like 2^53 from an
> Input read and you wan the most accurate possible SIN( of that ).

I can't think of a scenario where that would be useful (other than just
doing it for the sake of doing it).

If 2^53 represents a physical quantity, how likely is the actual value
to be known within ±π (+/i pi for those who prefer ASCII)?

If you can get better precision without too much extra cost, that's
great. I don't know enough to have an opinion about what the best
tradeoff is, but I presume it's going to be different depending on the
application.

Here's a C program that shows how precise sin(2^53) can be for types
float, double, and long double (I used gcc and glibc). The nextafter
functions are used to compute the nearest representable number. For
long double, the value of sin() changes by about 1 part in 1600, which
seems decent, but it's not nearly as precise as for values around 1.0.
For float and double, the imprecision of the argument is enough to make
the result practically meaningless.

#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>
int main(void) {
{
printf("float (%zu bits, %d mantissa bits)\n", CHAR_BIT * sizeof (float), FLT_MANT_DIG);
const float x = (float)(1LL<<53);
const float y = nextafterf(x, x*2);
printf("%.8f %.8f\n", x, sinf(x));
printf("%.8f %.8f\n", y, sinf(y));
}
putchar('\n');
{
printf("double (%zu bits, %d mantissa bits)\n", CHAR_BIT * sizeof (double), DBL_MANT_DIG);
const double x = (double)(1LL<<53);
const double y = nextafter(x, x*2);
printf("%.8f %.8f\n", x, sin(x));
printf("%.8f %.8f\n", y, sin(y));
}
putchar('\n');
{
printf("long double (%zu bits, %d mantissa bits)\n", CHAR_BIT * sizeof (long double), LDBL_MANT_DIG);
const long double x = (long double)(1LL<<53);
const long double y = nextafterl(x, x*2);
printf("%.8Lf %.8Lf\n", x, sinl(x));
printf("%.8Lf %.8Lf\n", y, sinl(y));
}
}

Output:

float (32 bits, 24 mantissa bits)
9007199254740992.00000000 -0.84892595
9007200328482816.00000000 -0.34159181

double (64 bits, 53 mantissa bits)
9007199254740992.00000000 -0.84892596
9007199254740994.00000000 -0.12729655

long double (128 bits, 64 mantissa bits)
9007199254740992.00000000 -0.84892596
9007199254740992.00097656 -0.84944168

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Radians Or Degrees?

<ut5bpu$354bh$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38084&group=comp.arch#38084

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc@freeuk.com (bart)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 00:00:00 +0000
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <ut5bpu$354bh$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 16 Mar 2024 23:59:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="86cdd72051d773a92e0c8f332750da77";
logging-data="3314033"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19E8IuUCq6wZbLiz/fnZcRh"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/0/IduIH/0hPw8V6xBInZndZFhQ=
In-Reply-To: <87o7bd3guo.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: bart - Sun, 17 Mar 2024 00:00 UTC

On 16/03/2024 23:19, Keith Thompson wrote:
> mitchalsup@aol.com (MitchAlsup1) writes:

>> Say you are a programmer and you receive a value like 2^53 from an
>> Input read and you wan the most accurate possible SIN( of that ).
>
> I can't think of a scenario where that would be useful (other than just
> doing it for the sake of doing it).
>
> If 2^53 represents a physical quantity, how likely is the actual value
> to be known within ±π (+/i pi for those who prefer ASCII)?
>
> If you can get better precision without too much extra cost, that's
> great. I don't know enough to have an opinion about what the best
> tradeoff is, but I presume it's going to be different depending on the
> application.
>
> Here's a C program that shows how precise sin(2^53) can be for types
> float, double, and long double (I used gcc and glibc). The nextafter
> functions are used to compute the nearest representable number. For
> long double, the value of sin() changes by about 1 part in 1600, which
> seems decent, but it's not nearly as precise as for values around 1.0.
> For float and double, the imprecision of the argument is enough to make
> the result practically meaningless.
>
> ...
> Output:
>
> float (32 bits, 24 mantissa bits)
> 9007199254740992.00000000 -0.84892595
> 9007200328482816.00000000 -0.34159181
>
> double (64 bits, 53 mantissa bits)
> 9007199254740992.00000000 -0.84892596
> 9007199254740994.00000000 -0.12729655
>
> long double (128 bits, 64 mantissa bits)
> 9007199254740992.00000000 -0.84892596
> 9007199254740992.00097656 -0.84944168

Is this output supposed to be different between gcc -O0 and gcc -O3?

Re: Radians Or Degrees?

<87jzm13af9.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38085&group=comp.arch#38085

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 18:38:02 -0700
Organization: None to speak of
Lines: 50
Message-ID: <87jzm13af9.fsf@nosuchdomain.example.com>
References: <ur5trn$3d64t$1@dont-email.me> <20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me> <ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com>
<ut5bpu$354bh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="bef1352e676cdb1e0584d8972e1644aa";
logging-data="3345898"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+exqL5jcKi9hS7i9YKRaor"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:2ZVnljiRYahJU0YwBdPk4IrZuUQ=
sha1:1dxqxr2lvHBhaSSN/gkJ/ujUPCc=
 by: Keith Thompson - Sun, 17 Mar 2024 01:38 UTC

bart <bc@freeuk.com> writes:
> On 16/03/2024 23:19, Keith Thompson wrote:
>> mitchalsup@aol.com (MitchAlsup1) writes:
>
>>> Say you are a programmer and you receive a value like 2^53 from an
>>> Input read and you wan the most accurate possible SIN( of that ).
>> I can't think of a scenario where that would be useful (other than
>> just
>> doing it for the sake of doing it).
>> If 2^53 represents a physical quantity, how likely is the actual
>> value
>> to be known within ±π (+/i pi for those who prefer ASCII)?
>> If you can get better precision without too much extra cost, that's
>> great. I don't know enough to have an opinion about what the best
>> tradeoff is, but I presume it's going to be different depending on the
>> application.
>> Here's a C program that shows how precise sin(2^53) can be for types
>> float, double, and long double (I used gcc and glibc). The nextafter
>> functions are used to compute the nearest representable number. For
>> long double, the value of sin() changes by about 1 part in 1600, which
>> seems decent, but it's not nearly as precise as for values around 1.0.
>> For float and double, the imprecision of the argument is enough to make
>> the result practically meaningless.
>>
>> ...
>> Output:
>> float (32 bits, 24 mantissa bits)
>> 9007199254740992.00000000 -0.84892595
>> 9007200328482816.00000000 -0.34159181
>> double (64 bits, 53 mantissa bits)
>> 9007199254740992.00000000 -0.84892596
>> 9007199254740994.00000000 -0.12729655
>> long double (128 bits, 64 mantissa bits)
>> 9007199254740992.00000000 -0.84892596
>> 9007199254740992.00097656 -0.84944168

>
> Is this output supposed to be different between gcc -O0 and gcc -O3?

No, why do you ask?

On my system, the output is identical with gcc and clang, and tcc at all
optimization levels, with both glibc and musl. I do get slightly
different results for long double on Cygwin vs. Ubuntu (Cygwin uses
newlib, not glibc).

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Radians Or Degrees?

<ut5im0$36bc4$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38086&group=comp.arch#38086

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc@freeuk.com (bart)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 01:57:22 +0000
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <ut5im0$36bc4$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me> <ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com> <ut5bpu$354bh$1@dont-email.me>
<87jzm13af9.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 17 Mar 2024 01:57:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="86cdd72051d773a92e0c8f332750da77";
logging-data="3353988"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Cyn14vlaVPJvrvzI1KLOD"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:17UbJYZbDMKzWBKTEWheFxI5EGU=
Content-Language: en-GB
In-Reply-To: <87jzm13af9.fsf@nosuchdomain.example.com>
 by: bart - Sun, 17 Mar 2024 01:57 UTC

On 17/03/2024 01:38, Keith Thompson wrote:
> bart <bc@freeuk.com> writes:
>> On 16/03/2024 23:19, Keith Thompson wrote:
>>> mitchalsup@aol.com (MitchAlsup1) writes:
>>
>>>> Say you are a programmer and you receive a value like 2^53 from an
>>>> Input read and you wan the most accurate possible SIN( of that ).
>>> I can't think of a scenario where that would be useful (other than
>>> just
>>> doing it for the sake of doing it).
>>> If 2^53 represents a physical quantity, how likely is the actual
>>> value
>>> to be known within ±π (+/i pi for those who prefer ASCII)?
>>> If you can get better precision without too much extra cost, that's
>>> great. I don't know enough to have an opinion about what the best
>>> tradeoff is, but I presume it's going to be different depending on the
>>> application.
>>> Here's a C program that shows how precise sin(2^53) can be for types
>>> float, double, and long double (I used gcc and glibc). The nextafter
>>> functions are used to compute the nearest representable number. For
>>> long double, the value of sin() changes by about 1 part in 1600, which
>>> seems decent, but it's not nearly as precise as for values around 1.0.
>>> For float and double, the imprecision of the argument is enough to make
>>> the result practically meaningless.
>>>
>>> ...
>>> Output:
>>> float (32 bits, 24 mantissa bits)
>>> 9007199254740992.00000000 -0.84892595
>>> 9007200328482816.00000000 -0.34159181
>>> double (64 bits, 53 mantissa bits)
>>> 9007199254740992.00000000 -0.84892596
>>> 9007199254740994.00000000 -0.12729655
>>> long double (128 bits, 64 mantissa bits)
>>> 9007199254740992.00000000 -0.84892596
>>> 9007199254740992.00097656 -0.84944168
>
>>
>> Is this output supposed to be different between gcc -O0 and gcc -O3?
>
> No, why do you ask?
>
> On my system, the output is identical with gcc and clang, and tcc at all
> optimization levels, with both glibc and musl. I do get slightly
> different results for long double on Cygwin vs. Ubuntu (Cygwin uses
> newlib, not glibc).

Because I get the results shown below. Even if the library is different
from yours, I would have assumed matching results.

------------------------------

C:\c>gcc c.c -O3

C:\c>a
float (32 bits, 24 mantissa bits)
9007199254740992.00000000 -0.84892595
9007200328482816.00000000 -0.34159181

double (64 bits, 53 mantissa bits)
9007199254740992.00000000 -0.84892596
9007199254740994.00000000 -0.12729655

long double (128 bits, 64 mantissa bits)
9007199254740992.00000000 -0.84892596
9007199254740992.00097656 -0.84944168

C:\c>gcc c.c -O0

C:\c>a
float (32 bits, 24 mantissa bits)
9007199254740992.00000000 -0.84893209
9007200328482816.00000000 -0.34160271

double (64 bits, 53 mantissa bits)
9007199254740992.00000000 -0.84893209
9007199254740994.00000000 -0.12728505

long double (128 bits, 64 mantissa bits)
9007199254740992.00000000 -0.84893209
9007199254740992.00097656 -0.84944780

C:\c>gcc --version
gcc (tdm64-1) 10.3.0

Re: Radians Or Degrees?

<87frwp36r6.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38087&group=comp.arch#38087

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sat, 16 Mar 2024 19:57:17 -0700
Organization: None to speak of
Lines: 110
Message-ID: <87frwp36r6.fsf@nosuchdomain.example.com>
References: <ur5trn$3d64t$1@dont-email.me> <ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com>
<ut5bpu$354bh$1@dont-email.me>
<87jzm13af9.fsf@nosuchdomain.example.com>
<ut5im0$36bc4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="bef1352e676cdb1e0584d8972e1644aa";
logging-data="3494669"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RxFqhwg0R3Mq/oRJs3oXd"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:VK1vRyexfuGU6y+CungcXa5OKxg=
sha1:WsTzHHkmXoM0n4NvCq9V1Z/RQyo=
 by: Keith Thompson - Sun, 17 Mar 2024 02:57 UTC

bart <bc@freeuk.com> writes:
> On 17/03/2024 01:38, Keith Thompson wrote:
>> bart <bc@freeuk.com> writes:
>>> On 16/03/2024 23:19, Keith Thompson wrote:
>>>> mitchalsup@aol.com (MitchAlsup1) writes:
>>>
>>>>> Say you are a programmer and you receive a value like 2^53 from an
>>>>> Input read and you wan the most accurate possible SIN( of that ).
>>>> I can't think of a scenario where that would be useful (other than
>>>> just
>>>> doing it for the sake of doing it).
>>>> If 2^53 represents a physical quantity, how likely is the actual
>>>> value
>>>> to be known within ±π (+/i pi for those who prefer ASCII)?
>>>> If you can get better precision without too much extra cost, that's
>>>> great. I don't know enough to have an opinion about what the best
>>>> tradeoff is, but I presume it's going to be different depending on the
>>>> application.
>>>> Here's a C program that shows how precise sin(2^53) can be for types
>>>> float, double, and long double (I used gcc and glibc). The nextafter
>>>> functions are used to compute the nearest representable number. For
>>>> long double, the value of sin() changes by about 1 part in 1600, which
>>>> seems decent, but it's not nearly as precise as for values around 1.0.
>>>> For float and double, the imprecision of the argument is enough to make
>>>> the result practically meaningless.
>>>>
>>>> ...
>>>> Output:
>>>> float (32 bits, 24 mantissa bits)
>>>> 9007199254740992.00000000 -0.84892595
>>>> 9007200328482816.00000000 -0.34159181
>>>> double (64 bits, 53 mantissa bits)
>>>> 9007199254740992.00000000 -0.84892596
>>>> 9007199254740994.00000000 -0.12729655
>>>> long double (128 bits, 64 mantissa bits)
>>>> 9007199254740992.00000000 -0.84892596
>>>> 9007199254740992.00097656 -0.84944168
>>
>>>
>>> Is this output supposed to be different between gcc -O0 and gcc -O3?
>> No, why do you ask?
>> On my system, the output is identical with gcc and clang, and tcc at
>> all
>> optimization levels, with both glibc and musl. I do get slightly
>> different results for long double on Cygwin vs. Ubuntu (Cygwin uses
>> newlib, not glibc).
>
>
> Because I get the results shown below. Even if the library is
> different from yours, I would have assumed matching results.
>
>
> ------------------------------
>
> C:\c>gcc c.c -O3
>
> C:\c>a
> float (32 bits, 24 mantissa bits)
> 9007199254740992.00000000 -0.84892595
> 9007200328482816.00000000 -0.34159181
>
> double (64 bits, 53 mantissa bits)
> 9007199254740992.00000000 -0.84892596
> 9007199254740994.00000000 -0.12729655
>
> long double (128 bits, 64 mantissa bits)
> 9007199254740992.00000000 -0.84892596
> 9007199254740992.00097656 -0.84944168
>
> C:\c>gcc c.c -O0
>
> C:\c>a
> float (32 bits, 24 mantissa bits)
> 9007199254740992.00000000 -0.84893209
> 9007200328482816.00000000 -0.34160271
>
> double (64 bits, 53 mantissa bits)
> 9007199254740992.00000000 -0.84893209
> 9007199254740994.00000000 -0.12728505
>
> long double (128 bits, 64 mantissa bits)
> 9007199254740992.00000000 -0.84893209
> 9007199254740992.00097656 -0.84944780
>
> C:\c>gcc --version
> gcc (tdm64-1) 10.3.0

I see similar results (possibly identical, I haven't checked) with
i686-w64-mingw32-gcc on Cygwin. I think it uses the same, or a similar,
runtime library as the tdm64 implementation you're using.

Comparing the generated assembly, at -O0 it generates a call to "sin",
while at -O1 and above it replaces the expression with a compile-time
constant. Apparently that compile-time constant matches the run-time
computed value for glibc, but not for whatever tdm64 uses.

I don't *think* it's a conformance issue as long as the precision is
within the standard's (fairly vague) requirements. When I modify the
program to start with sin(1.0) rather than sin(2**53), the output is
identical at all optimization levels.

Apparently glibc and the library used by tgm64 behave differently when
computing the sin of very large values. The result for sin(2**53) in
long double differs by about one part in 2**17 between -O0 and -O1, or
between gcc/glibc and tgm64.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Radians Or Degrees?

<20240317110621.00005b30@yahoo.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38088&group=comp.arch#38088

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5chosen@yahoo.com (Michael S)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 11:06:21 +0200
Organization: A noiseless patient Spider
Lines: 126
Message-ID: <20240317110621.00005b30@yahoo.com>
References: <ur5trn$3d64t$1@dont-email.me>
<ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me>
<20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me>
<ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="fd62a22e31fcf9828d4eedf77229489a";
logging-data="3610420"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+umJXZUvEfJIlsxkJ95KUoblO5a/X+18o="
Cancel-Lock: sha1:X3zIjhlTrqcKat/kX9jHPA5IdxA=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 17 Mar 2024 09:06 UTC

On Sat, 16 Mar 2024 16:19:11 -0700
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:

> mitchalsup@aol.com (MitchAlsup1) writes:
> > Michael S wrote:
> >> On Sat, 16 Mar 2024 01:16:25 +0000
> >> mitchalsup@aol.com (MitchAlsup1) wrote:
> >>> Keith Thompson wrote:
> >>> > I can see how computing sin(x) with high precision for
> >>> > "reasonable" values of x would be useful, but does any of that
> >>> > benefit from being able to compute sin(2^53) accurately?
> >>> Because accurate argument reduction reduces the burden on the
> >>> programmer to remain within his sandbox.
> >
> >> Not really.
> >
> > Say you are a programmer and you receive a value like 2^53 from an
> > Input read and you wan the most accurate possible SIN( of that ).
>
> I can't think of a scenario where that would be useful (other than
> just doing it for the sake of doing it).
>
> If 2^53 represents a physical quantity, how likely is the actual value
> to be known within ±π (+/i pi for those who prefer ASCII)?
>
> If you can get better precision without too much extra cost, that's
> great. I don't know enough to have an opinion about what the best
> tradeoff is, but I presume it's going to be different depending on the
> application.
>
> Here's a C program that shows how precise sin(2^53) can be for types
> float, double, and long double (I used gcc and glibc). The nextafter
> functions are used to compute the nearest representable number. For
> long double, the value of sin() changes by about 1 part in 1600, which
> seems decent, but it's not nearly as precise as for values around 1.0.
> For float and double, the imprecision of the argument is enough to
> make the result practically meaningless.
>
> #include <math.h>
> #include <stdio.h>
> #include <limits.h>
> #include <float.h>
> int main(void) {
> {
> printf("float (%zu bits, %d mantissa bits)\n", CHAR_BIT *
> sizeof (float), FLT_MANT_DIG); const float x = (float)(1LL<<53);
> const float y = nextafterf(x, x*2);
> printf("%.8f %.8f\n", x, sinf(x));
> printf("%.8f %.8f\n", y, sinf(y));
> }
> putchar('\n');
> {
> printf("double (%zu bits, %d mantissa bits)\n", CHAR_BIT *
> sizeof (double), DBL_MANT_DIG); const double x = (double)(1LL<<53);
> const double y = nextafter(x, x*2);
> printf("%.8f %.8f\n", x, sin(x));
> printf("%.8f %.8f\n", y, sin(y));
> }
> putchar('\n');
> {
> printf("long double (%zu bits, %d mantissa bits)\n", CHAR_BIT
> * sizeof (long double), LDBL_MANT_DIG); const long double x = (long
> double)(1LL<<53); const long double y = nextafterl(x, x*2);
> printf("%.8Lf %.8Lf\n", x, sinl(x));
> printf("%.8Lf %.8Lf\n", y, sinl(y));
> }
> }
>
> Output:
>
> float (32 bits, 24 mantissa bits)
> 9007199254740992.00000000 -0.84892595
> 9007200328482816.00000000 -0.34159181
>
> double (64 bits, 53 mantissa bits)
> 9007199254740992.00000000 -0.84892596
> 9007199254740994.00000000 -0.12729655
>
> long double (128 bits, 64 mantissa bits)
> 9007199254740992.00000000 -0.84892596
> 9007199254740992.00097656 -0.84944168
>

As written, your example does not emphasize that the problem has
nothing to do with implementation of sinX() library routine.
It's best illustrated by followup conversation with bart, IMHO 100%
O.T.
To make the point more clear I'd rather change it to following form:

#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>

void foo(long double x1, long double x2)
{ const double y1 = (double)sinl(x1);
const double y2 = (double)sinl(x2);
printf("%.20Le %.17f\n", x1, y1);
printf("%.20Le %.17f\n", x2, y2);
}

int main(void) {
const float x0 = (float)(1LL<<53);
{
printf("float (%zu bits, %d mantissa bits)\n", CHAR_BIT * sizeof
(float), FLT_MANT_DIG); const float x1 = x0;
const float x2 = nextafterf(x1, FLT_MAX);
foo(x1, x2);
}
putchar('\n');
{
printf("double (%zu bits, %d mantissa bits)\n", CHAR_BIT * sizeof
(double), DBL_MANT_DIG); const double x1 = x0;
const double x2 = nextafter(x1, FLT_MAX);
foo(x1, x2);
}
putchar('\n');
{
printf("long double (%zu bits, %d mantissa bits)\n", CHAR_BIT *
sizeof (long double), LDBL_MANT_DIG); const long double x1 = x0;
const long double x2 = nextafterl(x1, FLT_MAX);
foo(x1, x2);
}
}

Re: Radians Or Degrees?

<20240317113458.00000021@yahoo.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38089&group=comp.arch#38089

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5chosen@yahoo.com (Michael S)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 11:34:58 +0200
Organization: A noiseless patient Spider
Lines: 102
Message-ID: <20240317113458.00000021@yahoo.com>
References: <ur5trn$3d64t$1@dont-email.me>
<ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me>
<20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me>
<ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com>
<20240317110621.00005b30@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="fd62a22e31fcf9828d4eedf77229489a";
logging-data="3610420"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nnFf5o+TJsQXfdAikDtMpnDIAFIwgJB8="
Cancel-Lock: sha1:zqKqb1pbo5JT43IdV7B5LxlA/uw=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 17 Mar 2024 09:34 UTC

On Sun, 17 Mar 2024 11:06:21 +0200
Michael S <already5chosen@yahoo.com> wrote:

> On Sat, 16 Mar 2024 16:19:11 -0700
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>
> > mitchalsup@aol.com (MitchAlsup1) writes:
> > > Michael S wrote:
> > >> On Sat, 16 Mar 2024 01:16:25 +0000
> > >> mitchalsup@aol.com (MitchAlsup1) wrote:
> > >>> Keith Thompson wrote:
> > >>> > I can see how computing sin(x) with high precision for
> > >>> > "reasonable" values of x would be useful, but does any of that
> > >>> > benefit from being able to compute sin(2^53) accurately?
> > >>> Because accurate argument reduction reduces the burden on the
> > >>> programmer to remain within his sandbox.
> > >
> > >> Not really.
> > >
> > > Say you are a programmer and you receive a value like 2^53 from an
> > > Input read and you wan the most accurate possible SIN( of that ).
> > >
> >
> > I can't think of a scenario where that would be useful (other than
> > just doing it for the sake of doing it).
> >
> > If 2^53 represents a physical quantity, how likely is the actual
> > value to be known within ±π (+/i pi for those who prefer ASCII)?
> >
> > If you can get better precision without too much extra cost, that's
> > great. I don't know enough to have an opinion about what the best
> > tradeoff is, but I presume it's going to be different depending on
> > the application.
> >
> > Here's a C program that shows how precise sin(2^53) can be for types
> > float, double, and long double (I used gcc and glibc). The
> > nextafter functions are used to compute the nearest representable
> > number. For long double, the value of sin() changes by about 1
> > part in 1600, which seems decent, but it's not nearly as precise as
> > for values around 1.0. For float and double, the imprecision of the
> > argument is enough to make the result practically meaningless.
> >

<snip>

> >
>
> As written, your example does not emphasize that the problem has
> nothing to do with implementation of sinX() library routine.
> It's best illustrated by followup conversation with bart, IMHO 100%
> O.T.
> To make the point more clear I'd rather change it to following form:
>
<snip>
>

BTW, personally I'd prefer to illustrate futility of Payne-Hanek or
equivalent reduction with following example:

#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>

void foo(long double x)
{ const double y = (double)sinl(x);
printf("%.20Le %25.16La %.17f\n", x, x, y);
}

int main(void) {
const float a0 = 0x1p56;
const float b0 = 11;
{
printf("%-12s (%3zu bits, %d mantissa bits) ",
"float", CHAR_BIT * sizeof (float), FLT_MANT_DIG);
const float a = a0;
const float b = b0;
const float x = a / b;
foo(x);
}
{
printf("%-12s (%3zu bits, %d mantissa bits) ",
"double", CHAR_BIT * sizeof (double), DBL_MANT_DIG);
const double a = a0;
const double b = b0;
const double x = a / b;
foo(x);
}
{
printf("%-12s (%3zu bits, %d mantissa bits) ",
"long double", CHAR_BIT * sizeof (long double), LDBL_MANT_DIG);
const long double a = a0;
const long double b = b0;
const long double x = a / b;
foo(x);
}
}

Re: Radians Or Degrees?

<ut6mkh$3gsfm$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38091&group=comp.arch#38091

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 13:10:56 +0100
Organization: A noiseless patient Spider
Lines: 128
Message-ID: <ut6mkh$3gsfm$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com>
<8de6385435bbdb0695a7ff213653f345@www.novabbs.org>
<20240316190815.000005a2@yahoo.com>
<dbfb682bf2abb9b84ce04c257a85c6d1@www.novabbs.org>
<87o7bd3guo.fsf@nosuchdomain.example.com> <ut5bpu$354bh$1@dont-email.me>
<87jzm13af9.fsf@nosuchdomain.example.com> <ut5im0$36bc4$1@dont-email.me>
<87frwp36r6.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 17 Mar 2024 12:10:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="212cee952392c1402e125e2adac79188";
logging-data="3699190"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yTAThC4zx/qiTc8z3hEzRLkIvJeHkDzE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:X8QY98YY5Gy6MxTC6I30Pz5uhdY=
In-Reply-To: <87frwp36r6.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: David Brown - Sun, 17 Mar 2024 12:10 UTC

On 17/03/2024 03:57, Keith Thompson wrote:
> bart <bc@freeuk.com> writes:
>> On 17/03/2024 01:38, Keith Thompson wrote:
>>> bart <bc@freeuk.com> writes:
>>>> On 16/03/2024 23:19, Keith Thompson wrote:
>>>>> mitchalsup@aol.com (MitchAlsup1) writes:
>>>>
>>>>>> Say you are a programmer and you receive a value like 2^53 from an
>>>>>> Input read and you wan the most accurate possible SIN( of that ).
>>>>> I can't think of a scenario where that would be useful (other than
>>>>> just
>>>>> doing it for the sake of doing it).
>>>>> If 2^53 represents a physical quantity, how likely is the actual
>>>>> value
>>>>> to be known within ±π (+/i pi for those who prefer ASCII)?
>>>>> If you can get better precision without too much extra cost, that's
>>>>> great. I don't know enough to have an opinion about what the best
>>>>> tradeoff is, but I presume it's going to be different depending on the
>>>>> application.
>>>>> Here's a C program that shows how precise sin(2^53) can be for types
>>>>> float, double, and long double (I used gcc and glibc). The nextafter
>>>>> functions are used to compute the nearest representable number. For
>>>>> long double, the value of sin() changes by about 1 part in 1600, which
>>>>> seems decent, but it's not nearly as precise as for values around 1.0.
>>>>> For float and double, the imprecision of the argument is enough to make
>>>>> the result practically meaningless.
>>>>>
>>>>> ...
>>>>> Output:
>>>>> float (32 bits, 24 mantissa bits)
>>>>> 9007199254740992.00000000 -0.84892595
>>>>> 9007200328482816.00000000 -0.34159181
>>>>> double (64 bits, 53 mantissa bits)
>>>>> 9007199254740992.00000000 -0.84892596
>>>>> 9007199254740994.00000000 -0.12729655
>>>>> long double (128 bits, 64 mantissa bits)
>>>>> 9007199254740992.00000000 -0.84892596
>>>>> 9007199254740992.00097656 -0.84944168
>>>
>>>>
>>>> Is this output supposed to be different between gcc -O0 and gcc -O3?
>>> No, why do you ask?
>>> On my system, the output is identical with gcc and clang, and tcc at
>>> all
>>> optimization levels, with both glibc and musl. I do get slightly
>>> different results for long double on Cygwin vs. Ubuntu (Cygwin uses
>>> newlib, not glibc).
>>
>>
>> Because I get the results shown below. Even if the library is
>> different from yours, I would have assumed matching results.
>>
>>
>> ------------------------------
>>
>> C:\c>gcc c.c -O3
>>
>> C:\c>a
>> float (32 bits, 24 mantissa bits)
>> 9007199254740992.00000000 -0.84892595
>> 9007200328482816.00000000 -0.34159181
>>
>> double (64 bits, 53 mantissa bits)
>> 9007199254740992.00000000 -0.84892596
>> 9007199254740994.00000000 -0.12729655
>>
>> long double (128 bits, 64 mantissa bits)
>> 9007199254740992.00000000 -0.84892596
>> 9007199254740992.00097656 -0.84944168
>>
>> C:\c>gcc c.c -O0
>>
>> C:\c>a
>> float (32 bits, 24 mantissa bits)
>> 9007199254740992.00000000 -0.84893209
>> 9007200328482816.00000000 -0.34160271
>>
>> double (64 bits, 53 mantissa bits)
>> 9007199254740992.00000000 -0.84893209
>> 9007199254740994.00000000 -0.12728505
>>
>> long double (128 bits, 64 mantissa bits)
>> 9007199254740992.00000000 -0.84893209
>> 9007199254740992.00097656 -0.84944780
>>
>> C:\c>gcc --version
>> gcc (tdm64-1) 10.3.0
>
> I see similar results (possibly identical, I haven't checked) with
> i686-w64-mingw32-gcc on Cygwin. I think it uses the same, or a similar,
> runtime library as the tdm64 implementation you're using.
>
> Comparing the generated assembly, at -O0 it generates a call to "sin",
> while at -O1 and above it replaces the expression with a compile-time
> constant. Apparently that compile-time constant matches the run-time
> computed value for glibc, but not for whatever tdm64 uses.
>
> I don't *think* it's a conformance issue as long as the precision is
> within the standard's (fairly vague) requirements. When I modify the
> program to start with sin(1.0) rather than sin(2**53), the output is
> identical at all optimization levels.
>
> Apparently glibc and the library used by tgm64 behave differently when
> computing the sin of very large values. The result for sin(2**53) in
> long double differs by about one part in 2**17 between -O0 and -O1, or
> between gcc/glibc and tgm64.
>

That is interesting. It might not be a conformance issue, but it is a
divergence from the intention of the compiler. gcc makes use of a very
comprehensive library that emulates a whole range of floating point
hardware implementations to try to get bit-perfect compile-time versions
of run-time calculations, precisely so that it can do compile-time
calculations that fully match what you would get at run-time, regardless
of compilation flags and optimisation.

So if the program is producing different results for run-time and
compile-time versions of "sin", then there is a mismatch between the
configuration of the compiler and the run-time library it is using. I
don't know enough about the configuration options for gcc (there are a
/lot/ of them), but I know it can be configured to assume you are using
glibc or a glibc-compatible library. Perhaps the mingw build here is
configured with this option, but is actually using a run-time library
with a slightly implementation of these functions (such as an MS DLL C
library). If that is the case, then this is a mistake in the
configuration of gcc here, and I would think it could be reported back
to the mingw people as a bug.

Re: Radians Or Degrees?

<ut7khd$3nlv8$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38092&group=comp.arch#38092

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 13:41:16 -0700
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ut7khd$3nlv8$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com> <ut2ef1$2ffnh$2@dont-email.me>
<ut2el2$2ffnh$3@dont-email.me> <87sf0r2jso.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 17 Mar 2024 20:41:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fa1fc55c573ae485c64f06b83fc54ff2";
logging-data="3921896"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199gyGMRpduRpYZBW3WuvQ2fzMU4Vshlx4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:3/7E7Ok4blheIkOSmCSE8zfJJtU=
In-Reply-To: <87sf0r2jso.fsf@nosuchdomain.example.com>
Content-Language: en-US
 by: Chris M. Thomasson - Sun, 17 Mar 2024 20:41 UTC

On 3/15/2024 3:48 PM, Keith Thompson wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 3/15/2024 2:26 PM, Chris M. Thomasson wrote:
>> [...]
>>> Notice how the numbers are small? However, if we zoom in enough,
>>> then 2^53 might become an issue..
>> [...]
>>
>> Argh! I mean if we zoom in enough, then only 2^53 of precision might
>> become an issue... We can go in really deep:
>>
>> A deep zoom might be 10^275. Somebody did one to the 10^4141! I feel
>> like including a youtube link here, but I will refrain out of respect
>> for you.
>
> I don't object to YouTube links as long as they're reasonably relevant
> and there's enough information for readers to decide whether it's worth
> their time to open them.
>

Fair enough. :^)

Re: Radians Or Degrees?

<ut8h4e$mad$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38096&group=comp.arch#38096

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Sun, 17 Mar 2024 21:49:17 -0700
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <ut8h4e$mad$1@dont-email.me>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<ut17ji$27n6b$1@dont-email.me> <ut2csb$2fe4u$1@dont-email.me>
<87wmq32o26.fsf@nosuchdomain.example.com> <ut2ef1$2ffnh$2@dont-email.me>
<ut2el2$2ffnh$3@dont-email.me> <87sf0r2jso.fsf@nosuchdomain.example.com>
<ut7khd$3nlv8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 18 Mar 2024 04:49:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2f334d8170ee2357b03273f936eeb33c";
logging-data="22861"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+J4zqOwUuDSKC3HfjGV5PzBxH//ASIhD8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:i4kYIQA2StYl0LMb8xggukvJqHo=
In-Reply-To: <ut7khd$3nlv8$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Mon, 18 Mar 2024 04:49 UTC

On 3/17/2024 1:41 PM, Chris M. Thomasson wrote:
> On 3/15/2024 3:48 PM, Keith Thompson wrote:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 3/15/2024 2:26 PM, Chris M. Thomasson wrote:
>>> [...]
>>>> Notice how the numbers are small? However, if we zoom in enough,
>>>> then 2^53 might become an issue..
>>> [...]
>>>
>>> Argh! I mean if we zoom in enough, then only 2^53 of precision might
>>> become an issue... We can go in really deep:
>>>
>>> A deep zoom might be 10^275. Somebody did one to the 10^4141! I feel
>>> like including a youtube link here, but I will refrain out of respect
>>> for you.
>>
>> I don't object to YouTube links as long as they're reasonably relevant
>> and there's enough information for readers to decide whether it's worth
>> their time to open them.
>>
>
> Fair enough. :^)

Fwiw, another algorithm of mine that would benefit from high
precision... The fun part is that a point can be placed anywhere in the
field. So, it can be a big one. Depending on the users placement, so to
speak:

https://gallery.bridgesmathart.org/exhibitions/2024-joint-mathematics-meetings/chris-m-thomasson

Re: Radians Or Degrees?

<jwv1q87l5ou.fsf-monnier+comp.arch@gnu.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38098&group=comp.arch#38098

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: monnier@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Mon, 18 Mar 2024 15:18:17 -0400
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <jwv1q87l5ou.fsf-monnier+comp.arch@gnu.org>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="48a694d6848611bfd6e2114e2f6812b0";
logging-data="366994"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ajvhbPnyxJoCxJN2kT+puX49C7Z0HAlA="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:nttQBcuUryyotg47txEvt8B7JG8=
sha1:ZmKru1lza8PfrbPhnBBTGZj9gT4=
 by: Stefan Monnier - Mon, 18 Mar 2024 19:18 UTC

>> There are groups who have shown that exactly rounded trancendental
>> functions are in fact achievable with maybe 3X reduced performance.

That much? I had the impression it was significantly cheaper.

> At which cost in tables sizes?

My impression was that it wasn't costly in that respect, but since my
recollection seems to be off on the performance, maybe it's off here
as well.

> The critical point here is definition of what considered exact. If
> 'exact' is measured only on y side of y=foo(x), disregarding
> possible imprecision on the x side then you are very likely to end up
> with results that are slower to calculate, but not at all more useful
> from point of view of engineer or physicist. Exactly like Payne-Hanek
> or Mitch's equivalent of Payne-Hanek.

I don't know what are/were the motivations for the people working on
exact transcendentals, but they have applications unrelated to the fact
that they're "better": the main benefit (from this here PL guy) is that
it gives them a reliable, reproducible semantics.
Bit-for-bit reproducibility makes several things much easier.

Stefan

Re: Radians Or Degrees?

<9a5b9a6a445bd41ff75a93b589982970@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38099&group=comp.arch#38099

  copy link   Newsgroups: comp.lang.c comp.arch
Date: Mon, 18 Mar 2024 22:19:18 +0000
Subject: Re: Radians Or Degrees?
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.lang.c,comp.arch
X-Rslight-Site: $2y$10$SDhewOpTzRidS/IKEccjX.KJp3SZSjGaulWnSOka8OqDLhtAK96oO
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me> <20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me> <ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me> <ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me> <20240222233838.0000572f@yahoo.com> <3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org> <ur8nud$4n1r$1@dont-email.me> <936a852388e7e4414cb7e529da7095ea@www.novabbs.org> <ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com> <jwv1q87l5ou.fsf-monnier+comp.arch@gnu.org>
Organization: Rocksolid Light
Message-ID: <9a5b9a6a445bd41ff75a93b589982970@www.novabbs.org>
 by: MitchAlsup1 - Mon, 18 Mar 2024 22:19 UTC

Stefan Monnier wrote:

>>> There are groups who have shown that exactly rounded trancendental
>>> functions are in fact achievable with maybe 3X reduced performance.

> That much? I had the impression it was significantly cheaper.

The J. M. Muller book indicates about 2× to 2.5×

>> At which cost in tables sizes?

Making transcendental faster is always a tradeoff between table size
and speed. SIN() COS() can use 10-term polynomials when the reduced
argument is -¼pi..+¼pi, on the other hand, when the reduced argument
is ±0.008 a 3 term polynomial is just as accurate but you need 128×3
tables.

> My impression was that it wasn't costly in that respect, but since my
> recollection seems to be off on the performance, maybe it's off here
> as well.

ITANIC did rather well, here, because it had 2 FMAC units and could use
both for the polynomials.

>> The critical point here is definition of what considered exact. If
>> 'exact' is measured only on y side of y=foo(x), disregarding
>> possible imprecision on the x side then you are very likely to end up
>> with results that are slower to calculate, but not at all more useful
>> from point of view of engineer or physicist. Exactly like Payne-Hanek
>> or Mitch's equivalent of Payne-Hanek.

> I don't know what are/were the motivations for the people working on
> exact transcendentals, but they have applications unrelated to the fact
> that they're "better": the main benefit (from this here PL guy) is that
> it gives them a reliable, reproducible semantics.
> Bit-for-bit reproducibility makes several things much easier.

Consider moving an application which uses libm from machine to machine.
When libm is correctly rounded, there is no issue at all; not so other-
wise.

> Stefan

Re: Radians Or Degrees?

<jwv8r2djafq.fsf-monnier+comp.arch@gnu.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38100&group=comp.arch#38100

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: monnier@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Wed, 20 Mar 2024 09:54:36 -0400
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <jwv8r2djafq.fsf-monnier+comp.arch@gnu.org>
References: <ur5trn$3d64t$1@dont-email.me> <ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com> <ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me> <ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me> <ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me> <20240314112655.000011f8@yahoo.com>
<jwv1q87l5ou.fsf-monnier+comp.arch@gnu.org>
<9a5b9a6a445bd41ff75a93b589982970@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="08c998265a5aa3c91d4e4d5bc7e921b3";
logging-data="1609880"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fhfr4alqs+x6kijMtq/fpOvekCwTsqRM="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:J0RW/UYDtWFQ8PR7OkhajfOxAM4=
sha1:v8pFaN9c1uDvJF6Dy7aN3RiCZ08=
 by: Stefan Monnier - Wed, 20 Mar 2024 13:54 UTC

>>>> There are groups who have shown that exactly rounded trancendental
>>>> functions are in fact achievable with maybe 3X reduced performance.
>> That much? I had the impression it was significantly cheaper.
> The J. M. Muller book indicates about 2× to 2.5×

The [Rlibm](https://people.cs.rutgers.edu/~sn349/rlibm/) project claims
to get much better performance (basically, in the same ballpark as
not-correctly-rounded implementations).

[ Their key insight is the idea that to get correct rounding, you
shouldn't try to compute the best approximation of the exact result
and then round, but you should instead try to compute any
approximation whose rounding gives the correct result. ]

My impression was that their performance was good enough that the case
for not-correctly-rounded implementations becomes very weak.

>> I don't know what are/were the motivations for the people working on
>> exact transcendentals, but they have applications unrelated to the fact
>> that they're "better": the main benefit (from this here PL guy) is that
>> it gives them a reliable, reproducible semantics.
>> Bit-for-bit reproducibility makes several things much easier.
>
> Consider moving an application which uses libm from machine to machine.
> When libm is correctly rounded, there is no issue at all; not so other-
> wise.

Exactly!
[ Or should I say "Correctly rounded!"? ]

Stefan

Re: Radians Or Degrees?

<20240320182147.000067e1@yahoo.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=38101&group=comp.arch#38101

  copy link   Newsgroups: comp.lang.c comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5chosen@yahoo.com (Michael S)
Newsgroups: comp.lang.c,comp.arch
Subject: Re: Radians Or Degrees?
Date: Wed, 20 Mar 2024 18:21:47 +0200
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <20240320182147.000067e1@yahoo.com>
References: <ur5trn$3d64t$1@dont-email.me>
<ur5v05$3ccut$1@dont-email.me>
<20240222015920.00000260@yahoo.com>
<ur69j9$3ftgj$3@dont-email.me>
<ur86eg$1aip$1@dont-email.me>
<ur88e4$1rr1$5@dont-email.me>
<ur8a2p$2446$1@dont-email.me>
<ur8ctk$2vbd$2@dont-email.me>
<20240222233838.0000572f@yahoo.com>
<3b2e86cdb0ee8785b4405ab10871c5ca@www.novabbs.org>
<ur8nud$4n1r$1@dont-email.me>
<936a852388e7e4414cb7e529da7095ea@www.novabbs.org>
<ur9qtp$fnm9$1@dont-email.me>
<20240314112655.000011f8@yahoo.com>
<jwv1q87l5ou.fsf-monnier+comp.arch@gnu.org>
<9a5b9a6a445bd41ff75a93b589982970@www.novabbs.org>
<jwv8r2djafq.fsf-monnier+comp.arch@gnu.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="92be935da1beff2666dcf9ddcb3e2080";
logging-data="1601670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dtfdjUJraEPs8gXAl+iBAmm6oM0uEXhQ="
Cancel-Lock: sha1:tE/CzX8hXLsBWZ7avQxVfduJ45Q=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Wed, 20 Mar 2024 16:21 UTC

On Wed, 20 Mar 2024 09:54:36 -0400
Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> >>>> There are groups who have shown that exactly rounded
> >>>> trancendental functions are in fact achievable with maybe 3X
> >>>> reduced performance.
> >> That much? I had the impression it was significantly cheaper.
> > The J. M. Muller book indicates about 2× to 2.5×
>
> The [Rlibm](https://people.cs.rutgers.edu/~sn349/rlibm/) project
> claims to get much better performance (basically, in the same
> ballpark as not-correctly-rounded implementations).
>

I had only read the 1st page.
It sounds like they are not particularly interested in IEEE binary64
which appears to be the major point of interest of math libs of
conventional languages.

> [ Their key insight is the idea that to get correct rounding, you
> shouldn't try to compute the best approximation of the exact result
> and then round, but you should instead try to compute any
> approximation whose rounding gives the correct result. ]
>
> My impression was that their performance was good enough that the case
> for not-correctly-rounded implementations becomes very weak.
>

It all depend of what you compare against.
For scalar call for majority of transcendental functions on IEEE-754
list, it's probably very easy to get correctly rounded binary32 results
in approximately the same time as results calculated with max. err of,
say, 0.75 ULP. Especially so if target machine has fast binary64
arithmetic.
But in practice when we use lower (than binary64) precision we often
care about vector performance rather than scalar.
I.e. we care little about speed of sinf(), but want ippsTone_32f() as
fast as possible. In case you wonder, this function is part Intel
Performance Primitives and it is FAST. Writing correctly rounded
function that approaches the speed of this *almost* correctly
rounded routine (I think, for sane input ranges it's better than
0.55 ULP) would not be easy at all!

> >> I don't know what are/were the motivations for the people working
> >> on exact transcendentals, but they have applications unrelated to
> >> the fact that they're "better": the main benefit (from this here
> >> PL guy) is that it gives them a reliable, reproducible semantics.
> >> Bit-for-bit reproducibility makes several things much easier.
> >
> > Consider moving an application which uses libm from machine to
> > machine. When libm is correctly rounded, there is no issue at all;
> > not so other- wise.
>
> Exactly!
> [ Or should I say "Correctly rounded!"? ]
>
>
> Stefan

You like this proposal because you are implementer of the language/lib.
It makes your regression tests easier. And it's good challenge.
I don't like it because I am primarily user of the language/lib. My
floating-point tests have zero chance of repeatability of this sort for
a thousand of other reasons.
I don't want to pay for correct rounding of transcendental functions.
Neither in speed and especially nor in tables footprint. Not even a
little. Because for me there are no advantages.
Now, there are things that I am ready to pay for. E.g. preservation of
mathematical properties of original exact function. I.e. if original is
monotonic on certain interval then I do want at least weak monotonicity
of approximation. If original is even (or odd) I want the same for
approximation. If original never exceed 1, I want the same
for approximation. Etc... But correct rounding is not on the list.


devel / comp.arch / Re: Radians Or Degrees?

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor