Message-ID: <425E5496.5040905@biomserv.univ-lyon1.fr>
Date: 2005-04-14T11:31:34Z
From: Clément Calenge
Subject: Strange behavior of atan2
Dear all,
I've got a problem with the function atan2. For a couple of coordinates
x and y,
This function returns the angle between the vector of coordinates (x, y)
and the
abscissa axis, i.e. it is the same as atan(y/x) (as indicated on the
help page).
If we consider the vector with coordinates x = 0 and y = 0, we have
the following result:
> atan(0/0)
[1] NaN
This is expected. However:
> atan2(0,0)
[1] 0
Instead of a missing value, the function atan2 returns an angle equal to
0 radians.
I've searched through the help pages, the FAQ and the forum, but I
did'nt find
any explanation to this result. Does anyone know if this behavior is
expected, and
why ?
Thank you for any clues.
Regards,
Cl?ment Calenge
--
Cl?ment CALENGE
LBBE - UMR CNRS 5558 - Universit?
Claude Bernard Lyon 1 - FRANCE
tel. (+33) 04.72.43.27.57
fax. (+33) 04.72.43.13.88