#QUALITY by cg
class: RegressionTests::TypedArrayTests
added:
#test04a_halfFloatArray
#test04b_floatArray
#test04c_doubleArray
changed: #test04_halfFloatArray
--- a/RegressionTests__TypedArrayTests.st Thu Jun 06 12:41:28 2019 +0200
+++ b/RegressionTests__TypedArrayTests.st Thu Jun 06 18:05:24 2019 +0200
@@ -701,6 +701,55 @@
"/ -------------------------------------
"Modified: / 26-08-2016 / 13:27:57 / cg"
+!
+
+test04a_halfFloatArray
+ |a|
+
+"/ -------------------------------------
+
+ a := HalfFloatArray new:1.
+
+ a at:1 put:(1/3) asFloat.
+
+ "/ halfFloats have only rougly 3.5 digits precision
+ self assert:((a at:1) closeTo:0.3333333333 withEpsilon:0.001).
+ self assert:((a at:1) - 0.333333333333333) <= (HalfFloatArray epsilon * 2).
+
+ "Created: / 06-06-2019 / 13:09:08 / Claus Gittinger"
+ "Modified: / 06-06-2019 / 16:53:53 / Claus Gittinger"
+!
+
+test04b_floatArray
+ |a|
+
+"/ -------------------------------------
+
+ a := FloatArray new:1.
+
+ a at:1 put:(1/3) asFloat.
+
+ "/ floats have only rougly 6 digits precision
+ self assert:((a at:1) closeTo:0.3333333333 withEpsilon:0.0000001).
+ self assert:((a at:1) - 0.333333333333333) <= (ShortFloat epsilon * 2).
+
+ "Created: / 06-06-2019 / 13:09:33 / Claus Gittinger"
+!
+
+test04c_doubleArray
+ |a|
+
+"/ -------------------------------------
+
+ a := DoubleArray new:1.
+
+ a at:1 put:(1/3) asFloat.
+
+ self assert:((a at:1) closeTo:0.333333333333333).
+ self assert:((a at:1) - 0.333333333333333) < 1E-15.
+ self assert:((a at:1) - 0.333333333333333) <= (Float epsilon * 2).
+
+ "Created: / 06-06-2019 / 13:10:09 / Claus Gittinger"
! !
!TypedArrayTests class methodsFor:'documentation'!