������ self assert: 2.0 isWithin: 4 ulpFrom: 2.0 predecessor.One should writewould anwer false, but it makes no sense!������ self assert: 2.0 - 2.0 predecessor isWithin: 4 ulpFrom: 0.0.For example:Note that the this message cannot be used to test for zero result (because 0.0 ulp is the smallest denormal).������ self assert: 2.0 predecessor predecessor isWithin: 1 ulpFrom: 2.0.If we don't have symmetry, thenindeed, 2 and 2 predecessor do not have the same exponent, so do not have the same ulp.It's testing if the result are the same with a tolerance on least significant bits.������ ^(aFloat - anotherFloat) abs <= (anotherFloat ulp max: aFloat ulp)For floating points it would be good to also have something related to unit of least precision like I think it exists in google tests:assert: aFloat isWithin: anInteger ulpFrom: anotherFloat
(anotherFloat ulp max: aFloat ulp) is not really necessary, it's only for making the comparison symmetric.
might differ from:
������ self assert: 2.0 isWithin: 1 ulpFrom: 2.0 predecessor predecessor .
expected := 8085- 8084.9999.computed := (80.85 * 100) - 8084.9999.(computed - expected) abs <= (computed ulp max: expected ulp) �� ��"==> false"