Reputation: 1
I tried atan2
in C with argument of about 10-14.
It gives a wrong answer: around 90 instead of zero, e.g.:
void main()
{
double a =3.4e-14;
double b=9e-10;
atan2(3.4e14,9.0e-9); // returns ~90 instead of zero or Not a number
}
Upvotes: 0
Views: 417
Reputation: 27595
You've defined two variables a
and b
in your code,
but then you are using constants as arguments to atan2
.
The values of a
and b
are just ignored.
atan2(a, b);
would return a value near zero, as you would expect.
Same for atan2(3.4e-14,9.0e-9)
(note e-14
, not e14
).
Upvotes: 2
Reputation: 5959
It looks like you are calling atan2 on 3.4*10^14, not 3.14*10^(-14)?
Upvotes: 0