mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-03 02:10:53 +01:00
Add a test for 0-a as well
0-a can't be simplified with -a as 0 becomes -0 under negation.
This commit is contained in:
parent
d83ff5a8bd
commit
0daedcdb9b
1 changed files with 1 additions and 0 deletions
|
@ -96,6 +96,7 @@ assert((function() local a = 1 a = a / 2 return a end)() == 0.5)
|
|||
-- argument is passed into anonymous function to prevent constant folding
|
||||
assert((function(a) return tostring(a + 0) end)(-0) == "0")
|
||||
assert((function(a) return tostring(a - 0) end)(-0) == "-0")
|
||||
assert((function(a) return tostring(0 - a) end)(0) == "0")
|
||||
assert((function(a) return tostring(a - a) end)(1 / 0) == "nan")
|
||||
assert((function(a) return tostring(a * 0) end)(0 / 0) == "nan")
|
||||
assert((function(a) return tostring(a / (2^1000)) end)(2^1000) == "1")
|
||||
|
|
Loading…
Add table
Reference in a new issue