Files
wren/test/number/sqrt.wren
T
Bob Nystrom 193e4e30ab feat: add ceil, cos, sin, sqrt, isNan native methods and division-by-zero tests
Implement five new Num methods (ceil, cos, sin, sqrt, isNan) in wren_core.c and register them on the Num class. Add corresponding test files for ceil, floor, is_nan, and sqrt. Extend divide.wren with division-by-zero edge cases (inf, -inf, nan). Remove stale TODO comments from minus, multiply, and plus tests.
2014-01-08 15:47:14 +00:00

11 lines
314 B
Plaintext

IO.print(4.sqrt) // expect: 2
IO.print(1000000.sqrt) // expect: 1000
IO.print(1.sqrt) // expect: 1
IO.print(-0.sqrt) // expect: -0
IO.print(0.sqrt) // expect: 0
IO.print(2.sqrt) // expect: 1.4142135623731
IO.print(-4.sqrt.isNan) // expect: true
// TODO: Tests for sin and cos.