(float)"-NaN" should produce NaN, not Indet.

But (vector)"<-NaN, 0, 0>" produces Indet, not NaN.
This commit is contained in:
Sei Lisa 2017-01-12 03:29:38 +01:00
parent 5fff5f37d0
commit 4ec9396688

View file

@ -398,6 +398,11 @@ def InternalTypecast(val, out, InList, f32):
return 0.0
if match.group(1):
ret = F32(float.fromhex(match.group(0)), f32)
else:
if match.group(0).lower() == '-nan':
# (float)"-nan" produces NaN instead of Indet, even though
# (vector)"<-nan,0,0>" produces <Indet, 0., 0.>. Go figure.
ret = NaN
else:
ret = F32(float(match.group(0)), f32)
if not lslcommon.LSO and abs(ret) < 1.1754943508222875e-38: