mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sample/test.rb: NaN comparison test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
76d7e7d54c
commit
fd0fdbe908
2 changed files with 26 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Apr 11 15:56:08 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* sample/test.rb: NaN comparison test.
|
||||
|
||||
Fri Apr 11 15:37:43 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* numeric.c (coerce_rescue): prevent inspected String from GC.
|
||||
|
|
|
@ -972,6 +972,28 @@ test_ok((-2.6).truncate == -2)
|
|||
test_ok(2.6.round == 3)
|
||||
test_ok((-2.4).truncate == -2)
|
||||
test_ok((13.4 % 1 - 0.4).abs < 0.0001)
|
||||
nan = 0.0/0
|
||||
def nan.test(v)
|
||||
test_ok(self != v)
|
||||
test_ok((self < v) == false)
|
||||
test_ok((self > v) == false)
|
||||
test_ok((self <= v) == false)
|
||||
test_ok((self >= v) == false)
|
||||
end
|
||||
nan.test(nan)
|
||||
nan.test(0)
|
||||
nan.test(1)
|
||||
nan.test(-1)
|
||||
nan.test(1000)
|
||||
nan.test(-1000)
|
||||
nan.test(1_000_000_000_000)
|
||||
nan.test(-1_000_000_000_000)
|
||||
nan.test(100.0);
|
||||
nan.test(-100.0);
|
||||
nan.test(0.001);
|
||||
nan.test(-0.001);
|
||||
nan.test(1.0/0);
|
||||
nan.test(-1.0/0);
|
||||
|
||||
test_check "bignum"
|
||||
def fact(n)
|
||||
|
|
Loading…
Reference in a new issue