@@ -16,6 +16,11 @@ Class {
1616 #category : ' Math-Tests-ArbitraryPrecisionFloat'
1717}
1818
19+ { #category : #accessing }
20+ ArbitraryPrecisionFloatTest class >> defaultTimeLimit [
21+ ^ 60 seconds
22+ ]
23+
1924{ #category : #private }
2025ArbitraryPrecisionFloatTest >> checkDoublePrecision: y forFunction: func nBits: n [
2126 " Check that doubling the precision, then rounding would lead to the same result"
@@ -645,27 +650,37 @@ ArbitraryPrecisionFloatTest >> testPositive [
645650
646651{ #category : #' testing-converting' }
647652ArbitraryPrecisionFloatTest >> testPrintAndEvaluate [
648- < timeout: 50 " seconds" >
653+ " seconds"
654+
655+ < timeout: 50 >
649656 | emax emin leadingOne significands |
650- significands := 0 to: 1 < < 10 - 1 .
651- leadingOne := 1 < < 10 .
657+ significands := 0 to: ( 1 < < 10 ) - 1 .
658+ leadingOne := 1 < < 10 .
652659 emin := - 14 .
653660 emax := 15 .
654-
661+
655662 " Test all normal finite half precision float"
656- emin to: emax do: [:e |
657- significands do: [:s |
658- | f |
659- f := (leadingOne + s asArbitraryPrecisionFloatNumBits: 11 ) timesTwoPower: e - 10 .
660- self assert: (Compiler evaluate: f storeString) = f.
661- self assert: (Compiler evaluate: f printString) = f.]].
662-
663+ emin to: emax do: [ :e |
664+ significands
665+ do: [ :s |
666+ | f |
667+ f := (leadingOne + s asArbitraryPrecisionFloatNumBits: 11 )
668+ timesTwoPower: e - 10 .
669+ self
670+ assert: (Smalltalk compiler evaluate: f storeString)
671+ equals: f.
672+ self
673+ assert: (Smalltalk compiler evaluate: f printString)
674+ equals: f ] ].
675+
663676 " Test all subnormal finite half precision float"
664- significands do: [:s |
665- | f |
666- f := (s asArbitraryPrecisionFloatNumBits: s highBit) timesTwoPower: emin - 10 .
667- self assert: (Compiler evaluate: f storeString) = f.
668- self assert: (Compiler evaluate: f printString) = f].
677+ significands
678+ do: [ :s |
679+ | f |
680+ f := (s asArbitraryPrecisionFloatNumBits: s highBit)
681+ timesTwoPower: emin - 10 .
682+ self assert: (Smalltalk compiler evaluate: f storeString) equals: f.
683+ self assert: (Smalltalk compiler evaluate: f printString) equals: f ]
669684]
670685
671686{ #category : #' testing-arithmetic' }
0 commit comments