Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 23 Feb 2019 14:57:02 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Cc: Shane Seelig <stseelig@...l.com>
Subject: Re: x87 asin and acos

On Sat, Feb 23, 2019 at 10:08:58AM -0500, Rich Felker wrote:
> On Sat, Feb 23, 2019 at 09:21:08AM -0500, Shane Seelig wrote:
> > Currently 'asin' uses the algorithm:
> > 	arcsin(x) == arctan(x/(sqrt((1-x)(1+x))))
> > If the following algorithm were to be used instead, an 'fadd' could be
> > removed.
> > 	arcsin(x) == arctan(x/(sqrt(1-x**2)))
> 
> They don't seem to be numerically equal. For example, if x is smaller
> than sqrt(LDBL_EPSILON/2), 1-x**2 is 1, but (1-x)*(1+x) is not. I
> don't recall the process of writing the function in detail, but I'm
> pretty sure this matters to the result, especially since sqrt then
> expands the magnitude of the error.

After some discussion on irc, I think the above may be wrong. I'm not
sure if there are other cases where it can matter, but if not this is
probably a valid, and maybe useful, optimization.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.