mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Use hex notation for a denormal float.
This commit is contained in:
parent
68902c20f4
commit
f657d3e875
1 changed files with 4 additions and 3 deletions
|
@ -1643,8 +1643,9 @@ def llRotBetween(v1, v2):
|
|||
|
||||
ddc2 = dot*dot + csq
|
||||
|
||||
if ddc2 >= 1.5e-45:
|
||||
if csq >= 1.5e-45:
|
||||
DenormalStart = float.fromhex('0x1p-149')
|
||||
if ddc2 >= DenormalStart:
|
||||
if csq >= DenormalStart:
|
||||
s = math.sqrt(ddc2) + dot;
|
||||
m = math.sqrt(csq + s*s);
|
||||
return Quaternion(F32((cross[0]/m, cross[1]/m, cross[2]/m, s/m)))
|
||||
|
@ -1653,7 +1654,7 @@ def llRotBetween(v1, v2):
|
|||
if dot > 0:
|
||||
return ZERO_ROTATION
|
||||
m = math.sqrt(v1[0]*v1[0] + v1[1]*v1[1])
|
||||
if m >= 1.5e-45:
|
||||
if m >= DenormalStart:
|
||||
return Quaternion(F32((v1[1]/m, -v1[0]/m, 0., 0.)))
|
||||
return Quaternion((1., 0., 0., 0.))
|
||||
return ZERO_ROTATION
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue