[Proj] Proj4 Bug (rtodms)

cp ch.panel at free.fr
Thu Nov 2 07:34:36 EST 2006


due to floating point precision, there is a bug in source code of rtodms.c

the portion of code

  r = floor(r * CONV + .5);
  sec = fmod(r / RES, 60.);
  r = floor(r / RES60);
  min = fmod(r, 60.);
  deg = r / 60.;

must be replaced by

  r = floor(r * CONV + .5);
  sec = fmod(r / RES, 60.);
  r = floor(r / RES60);
  min = fmod(r, 60.);
  r = floor(r / 60.);
  deg = r;

the conversion of 0.06981317007977319578 (4 degree in radian)  is 3d with 
the first code (wrong) and  4d with the second (true).





More information about the Proj mailing list