fix: change infinity string representation from "inf" to "infinity" in num_toString

Update the num_toString primitive in wren_core.c to return "infinity" and "-infinity"
instead of the platform-dependent "inf" and "-inf" for positive and negative infinity
values. This ensures consistent string output across different C compilers and
platforms that may format infinity differently. Update the corresponding test
expectations in test/number/divide.wren to match the new output format.
This commit is contained in:
Bob Nystrom
2015-03-13 14:35:10 +00:00
parent 9c56d90e1c
commit e52573c3f6
2 changed files with 6 additions and 4 deletions
+4 -4
View File
@@ -2,11 +2,11 @@ IO.print(8 / 2) // expect: 4
IO.print(12.34 / -0.4) // expect: -30.85
// Divide by zero.
IO.print(3 / 0) // expect: inf
IO.print(-3 / 0) // expect: -inf
IO.print(3 / 0) // expect: infinity
IO.print(-3 / 0) // expect: -infinity
IO.print(0 / 0) // expect: nan
IO.print(-0 / 0) // expect: nan
IO.print(3 / -0) // expect: -inf
IO.print(-3 / -0) // expect: inf
IO.print(3 / -0) // expect: -infinity
IO.print(-3 / -0) // expect: infinity
IO.print(0 / -0) // expect: nan
IO.print(-0 / -0) // expect: nan