mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: Roland McGrath <mcgrathr@google.com>
Subject: [PATCH] math: fix 128bit long double inverse trigonometric functions
Date: Tue, 23 Aug 2016 21:47:53 +0200	[thread overview]
Message-ID: <20160823194752.GH1280@port70.net> (raw)

there was a copy paste error that could cause large ulp errors
in atan2l, atanl, asinl and acosl on aarch64, mips64 and mipsn32.

(the implementation is from freebsd fdlibm, but the tail end
of the polynomial was wrong. 128 bit long double functions
are not yet tested so this went undetected.)
---

this was found by the change
https://fuchsia.googlesource.com/magenta/+/5fd5aa1b2e567f6b6633fc84ea84443b496f7eb6%5E%21

i tested manually at a few inputs that the patch is sound,
the bug did not cause completely wrong results, the first
couple bits were fine since the leading coefficients were
correct.

 src/math/__invtrigl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/math/__invtrigl.c b/src/math/__invtrigl.c
index ef7f4e1..48f83aa 100644
--- a/src/math/__invtrigl.c
+++ b/src/math/__invtrigl.c
@@ -57,7 +57,7 @@ long double __invtrigl_R(long double z)
 {
 	long double p, q;
 	p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*(pS5+z*(pS6+z*(pS7+z*(pS8+z*pS9)))))))));
-	q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*(qS4+z*(qS5+z*(pS6+z*(pS7+z*(pS8+z*pS9))))))));
+	q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*(qS4+z*(qS5+z*(qS6+z*(qS7+z*(qS8+z*qS9))))))));
 	return p/q;
 }
 #endif
-- 
2.8.1



                 reply	other threads:[~2016-08-23 19:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160823194752.GH1280@port70.net \
    --to=nsz@port70.net \
    --cc=mcgrathr@google.com \
    --cc=musl@lists.openwall.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).