From ba7134c2a29e96ca79edf2e8ab6bb6367c72abab Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Sun, 29 Dec 2019 13:50:21 +0100 Subject: [PATCH] Use isfinite to determine if an FP number is valid. ref: https://forum.flightgear.org/viewtopic.php?f=30&t=36600&sid=4bdfcb69abb4a6440cd8965aa03815d5#p357164 --- simgear/nasal/mathlib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/simgear/nasal/mathlib.c b/simgear/nasal/mathlib.c index 7c8210f0..78fd1a26 100644 --- a/simgear/nasal/mathlib.c +++ b/simgear/nasal/mathlib.c @@ -9,9 +9,7 @@ static int valid(double d) { - union { double d; unsigned long long ull; } u; - u.d = d; - return ((u.ull >> 52) & 0x7ff) != 0x7ff; + return isfinite(d); } static naRef die(naContext c, const char* fn)