mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Fix minus zero in llFrand().
llFrand returns minus zero when given a negative denormal.
This commit is contained in:
parent
9d63e7268d
commit
1a06bf4eb9
1 changed files with 3 additions and 1 deletions
|
@ -1071,8 +1071,10 @@ def llFloor(f):
|
||||||
|
|
||||||
def llFrand(lim):
|
def llFrand(lim):
|
||||||
assert isfloat(lim)
|
assert isfloat(lim)
|
||||||
if math.isinf(lim) or abs(lim) < 1.1754943508222875e-38:
|
if math.isinf(lim):
|
||||||
return 0.
|
return 0.
|
||||||
|
if abs(lim) < float.fromhex('0x1p-126'):
|
||||||
|
return -0. if lim < 0 else 0.
|
||||||
if math.isnan(lim):
|
if math.isnan(lim):
|
||||||
return lim
|
return lim
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue