On Sun, 15 Sep 2024, Greg Troxel wrote:
The test program calls remquo twice, one with the -90 in a double, and once with it as a literal. The first time gets a positive q -- which messes up the sin calculation, wwhich is how I got here. The second is correct.
Not a math nerd, but, I can explain this part: it's GCC's "optimization" (yes, even without any `-O'). Generate the assembly with -S and you'll see that there's only one call to remquo(). There's no second call to remquo() because GCC has used its builtin math routines to calculate the (correct) result, and then passes this to printf(). Try again with -O and/or -fno-builtin, or a different compiler for more fun. Also here: https://www.unitedbsd.com/d/1427-long-double-trouble -RVP