mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Improve behaviour of llAtan2 to make it closer to SL's.
Especially regarding NaN inputs. Add regression tests.
This commit is contained in:
parent
159fae90bf
commit
14488ddd92
2 changed files with 32 additions and 0 deletions
|
@ -835,6 +835,14 @@ def llAsin(f):
|
|||
def llAtan2(y, x):
|
||||
assert isfloat(y)
|
||||
assert isfloat(x)
|
||||
if math.isnan(x) and math.isnan(y):
|
||||
if math.copysign(1, x) == -1 and math.copysign(1, y) == -1:
|
||||
return -NaN
|
||||
return NaN
|
||||
elif math.isnan(x):
|
||||
return x
|
||||
elif math.isnan(y):
|
||||
return y
|
||||
return F32(math.atan2(y, x))
|
||||
|
||||
def llAxes2Rot(fwd, left, up):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue