[GRASS-user] atan() in r.mapcalc

from the man page:
atan(x,y) inverse tangent of y/x (result is in degrees)

is this correct? is it y/x or x/y?

carlos
--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

"Carlos \"Guâno\" Grohmann" wrote:

from the man page:
atan(x,y) inverse tangent of y/x (result is in degrees)

is this correct? is it y/x or x/y?

The documentation is correct. When r.mapcalc's atan() function is
passed two arguments, it calls the ANSI C atan2() function with the
arguments swapped, then converts the result from -PI..PI radians to
0..360 degrees:

  res[i] = RADIANS_TO_DEGREES * atan2(arg2[i], arg1[i]);
  if (res[i] < 0)
    res[i] += 360.0;

The different argument order may be confusing, but changing it would
break existing scripts.

--
Glynn Clements <glynn@gclements.plus.com>