summaryrefslogtreecommitdiff
path: root/gps.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-01-04 12:39:53 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-01-04 12:39:53 +0000
commitb1006ba4f365f439a6842bcab481603cb25e50c3 (patch)
tree5973b115a489ab7bf603917d55035766af9f48df /gps.py
parent4f7cf66fdb20e5101d5f82e11ee9546a82c3ee60 (diff)
downloadgpsd-b1006ba4f365f439a6842bcab481603cb25e50c3.tar.gz
Use the method for testing for IEEE754 nan...
...recomended by the rejection notice on PEP 0754 and Michael Hartmann.
Diffstat (limited to 'gps.py')
-rwxr-xr-xgps.py15
1 files changed, 2 insertions, 13 deletions
diff --git a/gps.py b/gps.py
index 4a3aab02..c6f360b7 100755
--- a/gps.py
+++ b/gps.py
@@ -5,19 +5,8 @@
#
import time, calendar, math, socket, sys, select
-# Needed in all versions of Python that don't implement
-# 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
-# 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 = 1e10
-def isnan(x): return x > 1e9
+NaN = float('nan')
+def isnan(x): str(x) == 'nan'
ONLINE_SET = 0x00000001
TIME_SET = 0x00000002