junzis / pyModeS

Python decoder for Mode S and ADS-B signals
GNU General Public License v3.0
527 stars 151 forks source link

calculation of NL for -87 and 87 latitudes #62

Open wrobell opened 4 years ago

wrobell commented 4 years ago

The code is in cprNL function is

if lat == 87 or lat == -87:
    return 2

Considering that latitude is a float obtained using IEEE-754 standard, IMHO, it is highly unlikely we will hit -87/87 exactly (https://docs.python.org/3/tutorial/floatingpoint.html). Should math.isclose be used here (https://docs.python.org/3/library/math.html#math.isclose)?

junzis commented 4 years ago

You are absolutely right! Now fixed with commit ed18352.