1
0
forked from Mirror/wren

Add .isInfinity and .isInteger to Num.

This commit is contained in:
Bob Nystrom
2015-09-30 08:41:43 -07:00
parent 5129597c63
commit bacbd85543
4 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,3 @@
System.print(123.isInfinity) // expect: false
System.print((1/0).isInfinity) // expect: true
System.print((-10/0).isInfinity) // expect: true

View File

@ -0,0 +1,11 @@
System.print(123.isInteger) // expect: true
System.print(123.0.isInteger) // expect: true
System.print(0.isInteger) // expect: true
System.print(1.0000001.isInteger) // expect: false
System.print((-2.3).isInteger) // expect: false
// NaN is not an integer.
System.print((0/0).isInteger) // expect: false
// Infinity is not an integer.
System.print((1/0).isInteger) // expect: false