diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-01-04 12:39:53 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-01-04 12:39:53 +0000 |
commit | b1006ba4f365f439a6842bcab481603cb25e50c3 (patch) | |
tree | 5973b115a489ab7bf603917d55035766af9f48df /gps.py | |
parent | 4f7cf66fdb20e5101d5f82e11ee9546a82c3ee60 (diff) | |
download | gpsd-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-x | gps.py | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -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 |