mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-02 08:08: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
|
@ -27,13 +27,12 @@
|
|||
, (float)"-3.14e+0a"
|
||||
, (float)"--3.14e+0a"
|
||||
, (float)"0x3.14p+0a"
|
||||
, (float)"1.1754944e-38"
|
||||
, (float)"1.1754943e-38"
|
||||
, (float)"1.1754942e-38"
|
||||
, (float)"1.1754943157898258346e-38"
|
||||
, (float)"1.17549431578982583459e-38"
|
||||
// Known Mismatch:
|
||||
//, (float)"1.175494315789825834599e-38" // should give 0 but it fails
|
||||
, (float)"1.1754944e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (float)"1.1754943e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (float)"1.1754942e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (float)"1.1754943157898258346e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (float)"1.17549431578982583459e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (float)"1.175494315789825834599e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (vector)"<5.31,7.13,0x9.99"
|
||||
, (vector)"<5.31, 7.13, 0x9.99>"
|
||||
, (vector)"<5.31 , 7.13 , 0x9.99>"
|
||||
|
@ -125,13 +124,14 @@
|
|||
, (string)(1e39*0)
|
||||
, llList2CSV([1e0,1e1,1e2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,
|
||||
1e15,1e16,1e17,1e18,1e19,1e20,1e21,1e22,1e23,1e24,1e25,1e26,1e27,
|
||||
1e28,1e29,1e30,1e31,1e32,1e33,1e34,1e35,1e36,1e37,1e38])
|
||||
1e28,1e29,1e30,1e31,1e32,1e33,1e34])
|
||||
, llList2CSV([1e35,1e36,1e37,1e38])
|
||||
, llList2CSV((list)<(float)"NaN", 1e40*0, 1e40, -1e40>)
|
||||
, llList2CSV((list)"str")
|
||||
, (string)[1,3.14,(key)"blah",<1.,0.,0.,0.>]
|
||||
, llSin(-2147483648)
|
||||
, llSin(2147483647)
|
||||
, llSin(2147483647.0)
|
||||
, llSin(-2147483648)*128
|
||||
, llSin(2147483647)*128
|
||||
, llSin(2147483647.0)*128
|
||||
, 2147483647 * 1.0 * 2
|
||||
, 3 * 1.0 / 2
|
||||
, 3 / 2
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
, -3.14
|
||||
, 0.
|
||||
, 3.078125
|
||||
, 1.1754943e-38
|
||||
, 0.
|
||||
, 0.
|
||||
, 1.1754943e-38
|
||||
, 0.
|
||||
, 16777216.
|
||||
, 16777216.
|
||||
, 16777214.
|
||||
, 16777216.
|
||||
, 16777216.
|
||||
, 16777216.
|
||||
, <5.31, 7.13, 9.597656>
|
||||
, <5.31, 7.13, 9.597656>
|
||||
, <0., 0., 0.>
|
||||
|
@ -121,13 +122,14 @@
|
|||
, "Infinity"
|
||||
, "-Infinity"
|
||||
, "NaN"
|
||||
, "1.000000, 10.000000, 100.000000, 1000.000000, 10000.000000, 100000.000000, 1000000.000000, 10000000.000000, 100000000.000000, 1000000000.000000, 10000000000.000000, 99999997952.000000, 999999995904.000000, 9999999827968.000000, 100000000376832.000000, 999999986991104.000000, 10000000272564224.000000, 99999998430674944.000000, 999999984306749440.000000, 9999999980506447872.000000, 100000002004087734272.000000, 1000000020040877342720.000000, 9999999778196308361216.000000, 99999997781963083612160.000000, 1000000013848427855085568.000000, 9999999562023526247432192.000000, 100000002537764290115403776.000000, 999999988484154753734934528.000000, 9999999442119689768320106496.000000, 100000001504746621987668885504.000000, 1000000015047466219876688855040.000000, 9999999848243207295109594873856.000000, 100000003318135351409612647563264.000000, 999999994495727286427992885035008.000000, 9999999790214767953607394487959552.000000, 100000004091847875962975319375216640.000000, 999999961690316245365415600208216064.000000, 9999999933815812510711506376257961984.000000, 99999996802856924650656260769173209088.000000"
|
||||
, "1.000000, 10.000000, 100.000000, 1000.000000, 10000.000000, 100000.000000, 1000000.000000, 10000000.000000, 100000000.000000, 1000000000.000000, 10000000000.000000, 99999997952.000000, 999999995904.000000, 9999999827968.000000, 100000000376832.000000, 999999986991104.000000, 10000000272564224.000000, 99999998430674944.000000, 999999984306749440.000000, 9999999980506447872.000000, 100000002004087734272.000000, 1000000020040877342720.000000, 9999999778196308361216.000000, 99999997781963083612160.000000, 1000000013848427855085568.000000, 9999999562023526247432192.000000, 100000002537764290115403776.000000, 999999988484154753734934528.000000, 9999999442119689768320106496.000000, 100000001504746621987668885504.000000, 1000000015047466219876688855040.000000, 9999999848243207295109594873856.000000, 100000003318135351409612647563264.000000, 999999994495727286427992885035008.000000, 9999999790214767953607394487959552.000000"
|
||||
, "100000004091847875962975319375216640.000000, 999999961690316245365415600208216064.000000, 9999999933815812510711506376257961984.000000, 99999996802856924650656260769173209088.000000"
|
||||
, "<nan, -nan, inf, -inf>"
|
||||
, "str"
|
||||
, "13.140000blah<1.000000, 0.000000, 0.000000, 0.000000>"
|
||||
, 0.9713102
|
||||
, -0.9713102
|
||||
, -0.9713102
|
||||
, 124.327705
|
||||
, -124.327705
|
||||
, -124.327705
|
||||
, 4294967296.
|
||||
, 1.5
|
||||
, 1
|
||||
|
|
12
unit_tests/expr.suite/issue-17.lsl
Normal file
12
unit_tests/expr.suite/issue-17.lsl
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Test cases based on bug report by SaladDais@users.noreply.github.com;
|
||||
// see https://github.com/Sei-Lisa/LSL-PyOptimizer/issues/17
|
||||
// The first two cases are a change of behaviour in Mono, which used to return
|
||||
// zero when a string that represented a denormal was converted to float (LSO
|
||||
// did not have this problem).
|
||||
|
||||
// The last two cases are a screwup on the author's side.
|
||||
[ (string)((float)"-0.0")
|
||||
, (string)(1.4e-45 == (float)"1.4e-45")
|
||||
, (string)0.00000000000001
|
||||
, (string)-0.00000000000001
|
||||
]
|
1
unit_tests/expr.suite/issue-17.out
Normal file
1
unit_tests/expr.suite/issue-17.out
Normal file
|
@ -0,0 +1 @@
|
|||
["-0.000000", "1", "0.000000", "0.000000"]
|
|
@ -30,10 +30,10 @@
|
|||
, (vector)"<nan(1),nan,nano>"
|
||||
, (string)<0,0,0>
|
||||
, (string)[<0,0,0>]
|
||||
, (list)<(float)"nan", 2, 3>
|
||||
, (list)[<(float)"nan", 2, 3>]
|
||||
, (float)"1e-38"
|
||||
, (vector)"<1e-38,0,0>"
|
||||
, llList2Vector((list)<(float)"nan", 2, 3>, 0)
|
||||
, llList2Vector((list)[<(float)"nan", 2, 3>], 0)
|
||||
, (float)"1e-38"*85070591730234615865843651857942052864.*16777216.
|
||||
, (vector)"<1e-38,0,0>"*85070591730234615865843651857942052864.*16777216.
|
||||
, 1e40/1
|
||||
, 1e40-1e40
|
||||
, (1e40*0)*(1e40*0)
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
, 1e20
|
||||
, "nan"
|
||||
, "-nan"
|
||||
, "nan"
|
||||
, "nan"
|
||||
, "-nan"
|
||||
, "-nan"
|
||||
, "0.000000"
|
||||
, -0.
|
||||
, 0.
|
||||
|
@ -30,10 +30,10 @@
|
|||
, <0., 0., 0.>
|
||||
, "<0.00000, 0.00000, 0.00000>"
|
||||
, "<0.000000, 0.000000, 0.000000>"
|
||||
, [<(-1e40*0), 2., 3.>]
|
||||
, [<(-1e40*0), 2., 3.>]
|
||||
, 0.
|
||||
, <1e-38, 0., 0.>
|
||||
, <(-1e40*0), 2., 3.>
|
||||
, <(-1e40*0), 2., 3.>
|
||||
, 14272476.
|
||||
, <14272476., 0., 0.>
|
||||
, 1e40
|
||||
, (1e40*0)
|
||||
, (1e40*0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue