diff --git a/simgear/magvar/magvar.cxx b/simgear/magvar/magvar.cxx index 827ad04a..18ae58c1 100644 --- a/simgear/magvar/magvar.cxx +++ b/simgear/magvar/magvar.cxx @@ -271,7 +271,7 @@ double SGMagVar( double lat, double lon, double h, long dat, double* field ) field[4]=Y; field[5]=Z; /* output fields */ - /* find variation, convert to degrees! */ - return rad_to_deg(atan2(Y, X)); /* E is positive */ + /* find variation, leave in radians! */ + return atan2(Y, X); /* E is positive */ } diff --git a/simgear/magvar/testmagvar.cxx b/simgear/magvar/testmagvar.cxx index 8f18b6d0..1466745a 100644 --- a/simgear/magvar/testmagvar.cxx +++ b/simgear/magvar/testmagvar.cxx @@ -43,9 +43,12 @@ if (argc == 8){ var = SGMagVar( deg_to_rad(lat_deg), deg_to_rad(lon_deg), h, yymmdd_to_julian_days(yy,mm,dd), field ); +fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[0], field[1], field[2] ); +fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[3], field[4], field[5] ); fprintf(stdout,"%6.0lf %6.0lf %6.0lf %4.2lf %4.2lf \n", field[3],field[4],field[5], - rad_to_deg(atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))),var); + rad_to_deg(atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))), + rad_to_deg(var)); exit(0); }