mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Strings representing denormals no longer give 0 when cast to float
This annoyance and discrepancy with LSO was finally fixed by Linden Lab. The change has prompted some modifications to the test suite to accommodate for the new results. A further improvement has been to make these tests more friendly to be run in SL, making it easier to verify the results. Fixes #17. Reported by SaladDais@users.noreply.github.com - thanks!
This commit is contained in:
parent
7c630f4ce4
commit
281ff4d96a
8 changed files with 65 additions and 41 deletions
|
@ -500,16 +500,25 @@ def InternalTypecast(val, out, InList, f32):
|
|||
return 0.0
|
||||
if match.group(1):
|
||||
ret = float.fromhex(match.group(0))
|
||||
elif match.group(2):
|
||||
# (float)"-nan" produces NaN instead of Indet, even though
|
||||
# (vector)"<-nan,0,0>" produces <Indet, 0., 0.>. Go figure.
|
||||
ret = NaN
|
||||
# The following is no longer true as of Server 2022-05-05.571557;
|
||||
# exact date of change is unknown.
|
||||
# (float)"-nan" returns -nan now.
|
||||
#elif match.group(2):
|
||||
# # (float)"-nan" produces NaN instead of Indet, even though
|
||||
# # (vector)"<-nan,0,0>" produces <Indet, 0., 0.>. Go figure.
|
||||
# ret = NaN
|
||||
else:
|
||||
ret = float(match.group(0))
|
||||
if not lslcommon.LSO and abs(ret) < 1.1754943157898259e-38:
|
||||
# Mono doesn't return denormals when using (float)"val"
|
||||
# (but it returns them when using (vector)"<val,...>")
|
||||
ret = 0.0
|
||||
# The following is no longer true as of Server 2022-05-05.571557;
|
||||
# exact date of change is unknown.
|
||||
# Thanks to SaladDais@users.noreply.github.com for noticing.
|
||||
# Note that if the code needs to be resurrected, the sign needs
|
||||
# to be verified for the case (float)"-0.0"; we can no longer
|
||||
# check how it worked before.
|
||||
#if not lslcommon.LSO and abs(ret) < 1.1754943157898259e-38:
|
||||
# # Mono doesn't return denormals when using (float)"val"
|
||||
# # (but it returns them when using (vector)"<val,...>")
|
||||
# ret = 0.0
|
||||
return F32(ret, f32)
|
||||
if out == int:
|
||||
match = int_re.search(val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue