public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@cavium.com>
To: "Zack Weinberg" <zackw@panix.com>, "Ondřej Bílka" <neleai@seznam.cz>
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>,
	Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	nd <nd@arm.com>
Subject: Re: [PATCH 2/6] Remove slow paths from sin/cos
Date: Fri, 09 Mar 2018 23:05:00 -0000	[thread overview]
Message-ID: <1520636722.6774.157.camel@cavium.com> (raw)
In-Reply-To: <CAKCAbMg85h8JLK1qUNUgUUDVwU2WCnD4WCCputCM7qhr7y0i6w@mail.gmail.com>

On Fri, 2018-03-09 at 13:52 -0500, Zack Weinberg wrote:
> 
> More concretely, for IEEE single, the gap between representable values
> is bigger than 2π for values whose exponent is 2^26 or above.  Since
> the sine function is periodic over 2Ï€, that means the result of sinf()
> is effectively meaningless for any input at least that big - _any
> value_ within the input period could have been rounded to the
> representable, so the "true" answer could be anything.  (I am tempted
> to suggest that we return NaN for inputs this large, without even
> bothering to do argument reduction.)
> 
> For double, this happens at 2^55, and for x86-64 long double it
> happens at 2^66.  I _think_ x86-64 long double is 80-bit IEEE
> extended, not quad, but I could be wrong.
> 
> zw

And yet we have tests for large numbers in auto-libm-test-out-sin
and auto-libm-test-out-cos.  I was testing a different vector sin/cos
implementation on aarch64 and I got some big diffs on very large
output.  Maybe we shouldn't test for these values if they are not
of any value.

testing double (vector length 2)
Failure: Test: sin_vlen2 (-0x2p+64)
Result:
 is:         -0.0000000000000000e+00  -0x0.0000000000000p+0
 should be:   4.7183876212354675e-02   0x1.8287c2a760e04p-5
 difference:  4.7183876212354675e-02   0x1.8287c2a760e04p-5
 ulp       :  6799913194491396.0000
 max.ulp   :  1.0000
Failure: Test: sin_vlen2 (-0x3.3de320f6be87ep+1020)
Result:
 is:         -0.0000000000000000e+00  -0x0.0000000000000p+0
 should be:  -9.9219562491895441e-01  -0x1.fc0110a085bafp-1
 difference:  9.9219562491895441e-01   0x1.fc0110a085bafp-1
 ulp       :  8936903693327279.0000
 max.ulp   :  1.0000


  reply	other threads:[~2018-03-09 23:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 15:46 Wilco Dijkstra
2018-03-09 16:17 ` Siddhesh Poyarekar
2018-03-09 18:19   ` Ondřej Bílka
2018-03-09 18:52     ` Zack Weinberg
2018-03-09 23:05       ` Steve Ellcey [this message]
2018-03-10  0:52         ` Joseph Myers
2018-03-12 15:36           ` Wilco Dijkstra
2018-03-12 15:46             ` Zack Weinberg
2018-03-12 16:10             ` Joseph Myers
2018-03-12 21:13               ` Wilco Dijkstra
2018-03-09 19:06     ` Wilco Dijkstra
2018-03-09 19:31       ` Siddhesh Poyarekar
2018-03-12 18:09         ` Wilco Dijkstra
2018-03-13  8:53           ` Siddhesh Poyarekar

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=1520636722.6774.157.camel@cavium.com \
    --to=sellcey@cavium.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    --cc=neleai@seznam.cz \
    --cc=siddhesh@gotplt.org \
    --cc=zackw@panix.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).