From: Damian McGuckin <damianm@esi.com.au>
To: musl@lists.openwall.com
Cc: Morten Welinder <mwelinder@gmail.com>
Subject: Re: [musl] catan(z)
Date: Fri, 16 Aug 2024 11:47:03 +1000 (AEST) [thread overview]
Message-ID: <c2e8be32-74cf-082-5433-b37ae76fdd12@esi.com.au> (raw)
In-Reply-To: <20240815134415.GO10433@brightrain.aerifal.cx>
On Thu, 15 Aug 2024, Rich Felker wrote:
> On Thu, Aug 15, 2024 at 09:18:19AM -0400, Morten Welinder wrote:
>> atan2 definitely isn't supposed to always output rational numbers on
>> rational input.
>>
>> atan2(+0,-1) is Pi.
>> atan2(-0,-1) is -Pi
>> atan2(1,1) is Pi/4 -- clearly not a rational number.
>>
>> These aren't exactly rational results (unless you mean their
>> floating-point approximations).
>
> The way I read it, the claim was not that the exact mathematical value
> of atan2 for some argument is rational, but that the floating point
> number returned by the C function is necessarily rational (because all
> floating point numbers are diadic rationals) and thus never actually
> equal to ?pi. This means you don't have any issue with whatever
> happens exactly at the endpoints.
Precisely. Sorry if I was unclear Morten.
Actually, I think we need to ensure we use a value of Pi above which is
rounded towards zero (rather than one rounded to nearest tied to even) so
that it never lies outside the exact range of [-PI,+PI] where PI in this
case is an irrational number that we cannot represent with an IEEE 754
floating point number.
If we can enhance catan(z) to explicitly handle the special cases of Annex
G of the C standard, some of this discussion becomes a lot simpler. But
at the time he wrote this routine, Moshier did not have the luxury of a
standard to consult.
- Damian
prev parent reply other threads:[~2024-08-16 1:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-11 14:01 Damian McGuckin
2024-08-11 20:08 ` Szabolcs Nagy
2024-08-12 3:39 ` Damian McGuckin
2024-08-12 3:56 ` Damian McGuckin
2024-08-12 9:00 ` Szabolcs Nagy
2024-08-15 1:16 ` Rich Felker
2024-08-15 2:12 ` Damian McGuckin
2024-08-15 14:28 ` Rich Felker
2024-08-16 7:26 ` Szabolcs Nagy
2024-08-16 8:18 ` Eric Pruitt
2024-08-15 13:18 ` Morten Welinder
2024-08-15 13:44 ` Rich Felker
2024-08-16 1:47 ` Damian McGuckin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2e8be32-74cf-082-5433-b37ae76fdd12@esi.com.au \
--to=damianm@esi.com.au \
--cc=musl@lists.openwall.com \
--cc=mwelinder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).