Fix minus zero in llFrand().

llFrand returns minus zero when given a negative denormal.
This commit is contained in:
Sei Lisa 2017-01-16 20:37:11 +01:00
parent 9d63e7268d
commit 1a06bf4eb9

View file

@ -1071,8 +1071,10 @@ def llFloor(f):
def llFrand(lim):
assert isfloat(lim)
if math.isinf(lim) or abs(lim) < 1.1754943508222875e-38:
if math.isinf(lim):
return 0.
if abs(lim) < float.fromhex('0x1p-126'):
return -0. if lim < 0 else 0.
if math.isnan(lim):
return lim