aboutsummaryrefslogtreecommitdiff
path: root/src/geod_set.c
diff options
context:
space:
mode:
authorCharles Karney <charles@karney.com>2018-07-11 09:49:22 -0400
committerCharles Karney <charles@karney.com>2018-07-11 09:49:22 -0400
commit3e03508e043123dbdc3ebb00ce6c67f12c8f8c47 (patch)
treec45bf751a6b49539b0b615afe93c821fa94a0d2a /src/geod_set.c
parent81bfa7551ffb3f0406760f566c50b84370c3d020 (diff)
downloadPROJ-3e03508e043123dbdc3ebb00ce6c67f12c8f8c47.tar.gz
PROJ-3e03508e043123dbdc3ebb00ce6c67f12c8f8c47.zip
Fix #1074. Fix unit conversion factors for geod.
Previously, unit conversion using atof(unit_list[i].to_meter) which gives the wrong answer with, e.g., "1/10". Now it directly uses unit_list[i].factor (e.g., 0.1). Also fix all the conversion factors for the US Surveyor units so that they are the closest doubles. E.g., the conversion factors for US feet are factor rel error old 0.304800609601219 6e-16 12/39.37 1e-16 now 1200/3937.0 5e-17 Maybe someone should check the Indian units (but it's possible that India and Pakistan have different standards).
Diffstat (limited to 'src/geod_set.c')
-rw-r--r--src/geod_set.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/geod_set.c b/src/geod_set.c
index 479f18da..dacb0c73 100644
--- a/src/geod_set.c
+++ b/src/geod_set.c
@@ -37,7 +37,7 @@ geod_set(int argc, char **argv) {
for (i = 0; (s = unit_list[i].id) && strcmp(name, s) ; ++i) ;
if (!s)
emess(1,"%s unknown unit conversion id", name);
- fr_meter = 1. / (to_meter = atof(unit_list[i].to_meter));
+ fr_meter = 1. / (to_meter = unit_list[i].factor);
} else
to_meter = fr_meter = 1.;
geod_f = es/(1 + sqrt(1 - es));