public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "andreas_roever at web dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/103005] experimental simd sin and cos with big arguments returns values bigger than 1
Date: Sat, 06 Nov 2021 16:51:28 +0000	[thread overview]
Message-ID: <bug-103005-4-d4rbUsm5Ui@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103005-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103005

--- Comment #2 from Andreas Röver <andreas_roever at web dot de> ---
I think the source of the problem is function

__fold_input(const simd<double, _Abi>& __x)

in simd_math.h

this function should return values between -pi/4 and pi/4 but doesn't for the
big argument. E.g for 

2985064393126969344

it returns

27.678747

according to wolfram alpha it should return 

0.189812

This "big" value throws off the calculation of the power series that is
performed after this


the 27.678646 is the result of a rounding error

2985064393126969344 / (pi/2) is (according to wolfram alpha again) 

1900351014455063569.620838

but the CPU gets

1900351014455063552

This seems to be the closest value that the CPU can get to the real value.

the difference between those 2 times pi/2 is the above mentioned 27.67...

... now my numerics skills are not good enough to find a cure for that problem.

  parent reply	other threads:[~2021-11-06 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-30 17:15 [Bug libstdc++/103005] New: " andreas_roever at web dot de
2021-11-01 10:32 ` [Bug libstdc++/103005] " marxin at gcc dot gnu.org
2021-11-06 16:51 ` andreas_roever at web dot de [this message]
2021-11-06 16:52 ` andreas_roever at web dot de

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=bug-103005-4-d4rbUsm5Ui@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).