View Single Post
Old 07 February 2022, 10:58   #1335
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,146
Using latest version of amiga-gcc (4766d09 / Dec 24 2021) atan2(-1, 1) has wrong sign when compiling with -m68881 but *without* -noiexemul. I think this is the case for the entire quadrant.

Test case:
Code:
#include <stdio.h>
#include <math.h>
volatile double x = 1, y = -1;
int main() {
    printf("atan2(%f, %f) = %f (%f degrees)\n", y, x, atan2(y, x), atan2(y, x) * 180 / 3.141592653589793);
    return 0;
}
Results:
Code:
-mcpu=68020 -m68881 -lm             atan2(-1.000000, 1.000000) = 0.785398 (45.000000 degrees)
-mcpu=68020 -lm                     atan2(-1.000000, 1.000000) = -0.785398 (-45.000000 degrees)
-mcpu=68020 -m68881 -noixemul -lm   atan2(-1.000000, 1.000000) = -0.785398 (-45.000000 degrees)
(Not a big deal, the only reason I compiled without -noixemul is because I forgot, but quite noticeable when creating a tunnel table )
paraj is offline  
 
Page generated in 0.05614 seconds with 11 queries