From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 58EBA3858427; Sat, 6 Nov 2021 16:51:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58EBA3858427 From: "andreas_roever at web dot de" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: andreas_roever at web dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2021 16:51:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103005 --- Comment #2 from Andreas R=C3=B6ver --- I think the source of the problem is function __fold_input(const simd& __x) in simd_math.h this function should return values between -pi/4 and pi/4 but doesn't for t= he big argument. E.g for=20 2985064393126969344 it returns 27.678747 according to wolfram alpha it should return=20 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)=20 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 prob= lem.=