[Bug c++/116331] New: Math function non-determinism due to excessive precision and constant folding

2024-08-11 Thread carl at dehlin dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116331 Bug ID: 116331 Summary: Math function non-determinism due to excessive precision and constant folding Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity

[Bug middle-end/116331] Math function non-determinism due to constant folding of cos

2024-08-11 Thread carl at dehlin dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116331 --- Comment #3 from Carl Dehlin --- Thanks Andrew for your quick response and confirmation of what is going on. After reading through all the excessive precision stuff I was so sure this related to it! Very interesting to see that floating poin

[Bug middle-end/116331] Math function non-determinism due to constant folding of cos

2024-08-12 Thread carl at dehlin dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116331 --- Comment #4 from Carl Dehlin --- Found answer or 3) here: https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Known-Maximum-Errors-in-Math-Functions . For x86_64 cos is accurate up to 1 ulp from the correctly rounded value. As I un

[Bug middle-end/116331] Math function non-determinism due to constant folding of cos

2024-08-12 Thread carl at dehlin dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116331 --- Comment #6 from Carl Dehlin --- Thanks Jakub for your explanation. Indeed, the following program runs fine and confirms what you just said. Inspecting the assembly shows can both std::cos and __builtin_cos are substituted to a library call w