From: u-uy74@aetey.se
To: musl@lists.openwall.com
Subject: Re: for information, gcc-4.2.3 miscompiles musl math
Date: Sat, 21 Nov 2015 21:32:45 +0100 [thread overview]
Message-ID: <20151121203244.GZ26951@example.net> (raw)
In-Reply-To: <20151121200341.GH23362@port70.net>
On Sat, Nov 21, 2015 at 09:03:42PM +0100, Szabolcs Nagy wrote:
> > Hmm, which places does it add the stores around? Could you fix it with
> > an explicit conversion to double_t? That might be nice to harden
> > against broken compilers without penalizing correct ones.
>
> yeah that might work
>
> i dont have gcc-4.2, can you try:
>
> diff --git a/src/math/__rem_pio2.c b/src/math/__rem_pio2.c
> index a40db9f..d403f81 100644
> --- a/src/math/__rem_pio2.c
> +++ b/src/math/__rem_pio2.c
> @@ -118,7 +118,7 @@ int __rem_pio2(double x, double *y)
> if (ix < 0x413921fb) { /* |x| ~< 2^20*(pi/2), medium size */
> medium:
> /* rint(x/(pi/2)), Assume round-to-nearest. */
> - fn = x*invpio2 + toint - toint;
> + fn = (double_t)x*invpio2 + toint - toint;
> n = (int32_t)fn;
> r = x - fn*pio2_1;
> w = fn*pio2_1t; /* 1st round, good to 85 bits */
Sure, the result:
sin(8.000000) = 0.989358
Which is the same as produced by musl-1.0.0+, without this patch,
iow the expected "good" value.
Thanks!
Rune
next prev parent reply other threads:[~2015-11-21 20:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-21 17:24 u-uy74
2015-11-21 19:25 ` Rich Felker
2015-11-21 19:41 ` Szabolcs Nagy
2015-11-21 19:49 ` Rich Felker
2015-11-21 19:56 ` Szabolcs Nagy
2015-11-21 19:51 ` Rich Felker
2015-11-21 20:03 ` Szabolcs Nagy
2015-11-21 20:15 ` Rich Felker
2015-11-21 21:54 ` Szabolcs Nagy
2015-11-21 20:32 ` u-uy74 [this message]
2015-11-21 20:11 ` u-uy74
2015-11-21 20:18 ` Rich Felker
2015-11-21 20:30 ` Alexander Monakov
2015-11-21 21:08 ` u-uy74
2015-11-22 4:00 ` Isaac Dunham
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=20151121203244.GZ26951@example.net \
--to=u-uy74@aetey.se \
--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).