From 4ec93966888e059e23b32ca3845b90a09cab87bf Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Thu, 12 Jan 2017 03:29:38 +0100 Subject: [PATCH] (float)"-NaN" should produce NaN, not Indet. But (vector)"<-NaN, 0, 0>" produces Indet, not NaN. --- lslopt/lslbasefuncs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lslopt/lslbasefuncs.py b/lslopt/lslbasefuncs.py index fbb6b4c..20f7e18 100644 --- a/lslopt/lslbasefuncs.py +++ b/lslopt/lslbasefuncs.py @@ -399,7 +399,12 @@ def InternalTypecast(val, out, InList, f32): if match.group(1): ret = F32(float.fromhex(match.group(0)), f32) else: - ret = F32(float(match.group(0)), f32) + if match.group(0).lower() == '-nan': + # (float)"-nan" produces NaN instead of Indet, even though + # (vector)"<-nan,0,0>" produces . Go figure. + ret = NaN + else: + ret = F32(float(match.group(0)), f32) if not lslcommon.LSO and abs(ret) < 1.1754943508222875e-38: # Mono doesn't return denormals when using (float)"val" # (but it returns them when using (vector)"")