summaryrefslogtreecommitdiff
path: root/gps.py
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2005-08-03 05:55:00 +0000
committerGary E. Miller <gem@rellim.com>2005-08-03 05:55:00 +0000
commit056c3753004ae9f55d84c04f8ac3e4971ddd1c21 (patch)
tree997793766c959aabb8b5d8d21922f94b41272cf1 /gps.py
parente313c04bed6281949c56b65ddeb51f2325f31764 (diff)
downloadgpsd-056c3753004ae9f55d84c04f8ac3e4971ddd1c21.tar.gz
gpsprof with altitude works again on garmin GPS 18USB.
NaN is problematic in Python, use PosInf instead until isnan is in the standard Python library.
Diffstat (limited to 'gps.py')
-rwxr-xr-xgps.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/gps.py b/gps.py
index ad934adb..cc2583cd 100755
--- a/gps.py
+++ b/gps.py
@@ -9,8 +9,15 @@ from math import *
# PEP 75 (http://python.fyxm.net/peps/pep-0754.html).
# This includes at least versions up to 2.3.4.
PosInf = 1e300000
-NaN = PosInf/PosInf
-def isnan(x): return x == NaN
+# NaN = PosInf/PosInf
+# IEEE754 says NaN == NaN is always false!
+# so this is wrong:
+# def isnan(x): return x == NaN
+
+# so let's use PosInf as a proxy
+# this is not mathmetically correct but good enough for altitude
+NaN = PosInf
+def isnan(x): return x > 1e300000
ONLINE_SET = 0x00000001
TIME_SET = 0x00000002