'From Squeak3.10beta of 22 July 2007 [latest update: #7137] on 17 October 2007 at 11:54:18 pm'!
!FloatTest methodsFor: 'infinity behavior' stamp: 'nice 10/17/2007 23:54'!
testInfinityCloseTo
"This is a test for bug http://bugs.squeak.org/view.php?id=6729:"
"FloatTest new testInfinityCloseTo"
self deny: (Float infinity closeTo: Float infinity negated).
self deny: (Float infinity negated closeTo: Float infinity).
"SHOULD this really be so:
self assert: (Float infinity closeTo: Float infinity).
IEEE 754 states it should:
self assert: Float infinity = Float infinity.
However, comparing inf is somewhat messy:
(lim (x->inf) 2*x) = inf
(lim (x->inf) x) = inf
(lim (x->inf) 2*x-x) = inf
Hmm these inf are not even close...
IEEE 754 has the right answer and contradict itself with:
self assert: (Float infinity - Float infinity) isNan.
So why consider them equal?
I would better understand:
self deny: (Float infinity closeTo: Float infinity).
Like nan, infinity cannot compare. All we can assert is isInf, but not = inf.
Until someone comes with a good rationale, i prefer these assertions to be kept un-activated"! !