Fix llRound behaviour in corner cases.
We had too much precision. In LSL, llRound(0.49999997) gives 1, not 0, because the loss of precision after adding 0.5 to that makes the result 1. Fixed by converting to F32 prior to flooring.
This commit is contained in:
@@ -1697,7 +1697,7 @@ def llRound(f):
|
||||
assert isfloat(f)
|
||||
if math.isnan(f) or math.isinf(f) or f >= 2147483647.5 or f < -2147483648.0:
|
||||
return -2147483648
|
||||
return int(math.floor(f+0.5))
|
||||
return int(math.floor(F32(f+0.5)))
|
||||
|
||||
def llSHA1String(s):
|
||||
assert isstring(s)
|
||||
|
||||
Reference in New Issue
Block a user