[Pkg] The Trunk: KernelTests-nice.189.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri May 6 21:23:04 UTC 2011
Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.189.mcz
==================== Summary ====================
Name: KernelTests-nice.189
Author: nice
Time: 6 May 2011, 11:22:41.491 pm
UUID: c9dd79bd-c33f-4730-bcc5-b95e0fe66d27
Ancestors: KernelTests-cmm.188
Add a test for Float>>#ulp
=============== Diff against KernelTests-cmm.188 ===============
Item was added:
+ ----- Method: FloatTest>>testUlp (in category 'characterization') -----
+ testUlp
+
+ {Float pi predecessor. Float pi. Float pi successor} do:
+ [:f |
+ self assert: (f * 2) ulp = (f ulp * 2).
+ self assert: (f / 2) ulp = (f ulp / 2).
+ self deny: f + f ulp = f.
+ self deny: f - f ulp = f.
+ "Tests below are valid as long as default rounding mode (to nearest even) is used"
+ self assert: f significandAsInteger odd ==> (f ulp / 2.0 + f = f successor).
+ self assert: f significandAsInteger even ==> (f ulp / 2.0 + f = f)].
+
+ self assert: 0.0 ulp = Float fmin.
+ self assert: 1.0 ulp = Float epsilon.
+ self assert: Float nan ulp isNaN.
+ self assert: Float infinity ulp = Float infinity.
+ self assert: Float infinity negated ulp = Float infinity.
+
+ self assert: ((0 to: Float precision - 1) allSatisfy: [:each | (Float fmin timesTwoPower: each) ulp = Float fmin]). !
More information about the Packages
mailing list