[Bug c/93743] New: swapped arguments in atan2l
development at drmh dot de
gcc-bugzilla@gcc.gnu.org
Fri Feb 14 17:35:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93743
Bug ID: 93743
Summary: swapped arguments in atan2l
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: development at drmh dot de
Target Milestone: ---
Created attachment 47843
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47843&action=edit
all files to reproduce
Hi.
Compared to atan2() the atan2l() function gets their arguments swapped, it is
reproducable by the attached script and sourcecode. I checked aginast clang
which doesn't have the issue.
Thanks.
#include <stdio.h>
#include <math.h>
void test ( const long double y, const long double x ) {
const long double ldbl_n = atan2l (y, x);
const long double ldbl_s = atan2l (x, y); // arguments swapped
printf ("normal : y=%Lf, x=%Lf, atan2=%Lf\n", y, x, ldbl_n);
printf ("swapped: y=%Lf, x=%Lf, atan2=%Lf\n", y, x, ldbl_s);
if ( ldbl_n < 1.L || 1.L < ldbl_s ) {
printf ("BUG!\n");
}
const double dbl_n = atan2 (y, x);
const double dbl_s = atan2 (x, y); // arguments swapped
printf ("normal : y=%Lf, x=%Lf, atan2=%lf\n", y, x, dbl_n);
printf ("swapped: y=%Lf, x=%Lf, atan2=%lf\n", y, x, dbl_s);
if ( dbl_n < 1.L || 1.L < dbl_s ) {
printf ("BUG!\n");
}
printf ("\n");
}
int main ( void ) {
const long double y = 0.922766L;
const long double x = 0.080466L;
test (y, x);
return 0;
}
gcc-output:
normal : y=0.922766, x=0.080466, atan2=0.086981
swapped: y=0.922766, x=0.080466, atan2=1.483815
BUG!
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
clang-output:
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
normal : y=0.922766, x=0.080466, atan2=1.483815
swapped: y=0.922766, x=0.080466, atan2=0.086981
Full details attached in the tar-archive.
More information about the Gcc-bugs
mailing list