mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Cc: Shane Seelig <stseelig@mail.com>
Subject: Re: x87 asin and acos
Date: Sat, 23 Feb 2019 14:57:02 -0500	[thread overview]
Message-ID: <20190223195702.GN23599@brightrain.aerifal.cx> (raw)
In-Reply-To: <20190223150858.GM23599@brightrain.aerifal.cx>

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


  reply	other threads:[~2019-02-23 19:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-23 14:21 Shane Seelig
2019-02-23 15:08 ` Rich Felker
2019-02-23 19:57   ` Rich Felker [this message]
2019-02-24  2:53     ` Damian McGuckin
2019-02-23 20:30 ` Szabolcs Nagy
2019-02-23 20:36   ` Szabolcs Nagy

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=20190223195702.GN23599@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=stseelig@mail.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).