forked from Mirror/wren
Added Num.pi and some tests
This commit is contained in:
3
test/core/number/acos.wren
Normal file
3
test/core/number/acos.wren
Normal file
@ -0,0 +1,3 @@
|
||||
IO.print(0.acos) // expect: 1.5707963267949
|
||||
IO.print(1.acos) // expect: 0
|
||||
IO.print((-1).acos) // expect: 3.1415926535898
|
||||
3
test/core/number/asin.wren
Normal file
3
test/core/number/asin.wren
Normal file
@ -0,0 +1,3 @@
|
||||
IO.print(0.asin) // expect: 0
|
||||
IO.print(1.asin) // expect: 1.5707963267949
|
||||
IO.print((-1).asin) // expect: -1.5707963267949
|
||||
2
test/core/number/atan.wren
Normal file
2
test/core/number/atan.wren
Normal file
@ -0,0 +1,2 @@
|
||||
IO.print(0.atan) // expect: 0
|
||||
IO.print(1.atan) // expect: 0.78539816339745
|
||||
4
test/core/number/atan2.wren
Normal file
4
test/core/number/atan2.wren
Normal file
@ -0,0 +1,4 @@
|
||||
IO.print(0.atan(0)) // expect: 0
|
||||
IO.print(0.atan(1)) // expect: 0
|
||||
|
||||
IO.print(1.atan(0)) // expect: 1.5707963267949
|
||||
6
test/core/number/cos.wren
Normal file
6
test/core/number/cos.wren
Normal file
@ -0,0 +1,6 @@
|
||||
IO.print(0.cos) // expect: 1
|
||||
IO.print(Num.pi.cos) // expect: -1
|
||||
IO.print((2 * Num.pi).cos) // expect: 1
|
||||
|
||||
// this should of course be 0, but it's not that precise
|
||||
IO.print((Num.pi / 2).cos) // expect: 6.1232339957368e-17
|
||||
6
test/core/number/sin.wren
Normal file
6
test/core/number/sin.wren
Normal file
@ -0,0 +1,6 @@
|
||||
IO.print(0.sin) // expect: 0
|
||||
IO.print((Num.pi / 2).sin) // expect: 1
|
||||
|
||||
// these should of course be 0, but it's not that precise
|
||||
IO.print(Num.pi.sin) // expect: 1.2246467991474e-16
|
||||
IO.print((2 * Num.pi).sin) // expect: -2.4492935982947e-16
|
||||
3
test/core/number/tan.wren
Normal file
3
test/core/number/tan.wren
Normal file
@ -0,0 +1,3 @@
|
||||
IO.print(0.tan) // expect: 0
|
||||
IO.print((Num.pi / 4).tan) // expect: 1
|
||||
IO.print((-Num.pi / 4).tan) // expect: -1
|
||||
Reference in New Issue
Block a user