--- a/RegressionTests__FloatTest.st Tue Jun 17 10:16:44 2003 +0200
+++ b/RegressionTests__FloatTest.st Tue Jun 17 10:19:21 2003 +0200
@@ -10,8 +10,46 @@
!
+!FloatTest methodsFor:'helpers'!
+
+actualPrecisionOf:aFloatClass
+ "get the actual number of valid bits in the mantissa.
+ This does a real test (i.e. does not believe the compiled-in ifdefs)"
+
+ |one half x count|
+
+ one := aFloatClass unity. "/ 1.0 in this class
+ half := one coerce:0.5.
+ x := one.
+ count := 0.
+
+ [ one + x ~= one] whileTrue:[
+ x := x * half.
+ count := count + 1.
+ ].
+ ^ count
+
+ "
+ self basicNew actualPrecisionOf:ShortFloat
+ self basicNew actualPrecisionOf:Float
+ self basicNew actualPrecisionOf:LongFloat
+ "
+! !
+
!FloatTest methodsFor:'tests'!
+test00_Precision
+ "computed precision vs. assumed precision."
+
+ self assert:( Float precision == (self actualPrecisionOf:Float)).
+ self assert:( ShortFloat precision == (self actualPrecisionOf:ShortFloat)).
+ self assert:( LongFloat precision == (self actualPrecisionOf:LongFloat)).
+
+ "
+ self basicNew test00_Precision
+ "
+!
+
test01_Nan
"NaN in all avaliable formats."