Skip to content

Commit 151e136

Browse files
Fix #71
1 parent d0acf00 commit 151e136

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

src/Math-Tests-ArbitraryPrecisionFloat/ArbitraryPrecisionFloatTest.class.st

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Class {
1616
#category : 'Math-Tests-ArbitraryPrecisionFloat'
1717
}
1818

19+
{ #category : #accessing }
20+
ArbitraryPrecisionFloatTest class >> defaultTimeLimit [
21+
22+
^ 120 seconds
23+
]
24+
1925
{ #category : #private }
2026
ArbitraryPrecisionFloatTest >> checkDoublePrecision: y forFunction: func nBits: n [
2127
"Check that doubling the precision, then rounding would lead to the same result"
@@ -645,27 +651,37 @@ ArbitraryPrecisionFloatTest >> testPositive [
645651

646652
{ #category : #'testing-converting' }
647653
ArbitraryPrecisionFloatTest >> testPrintAndEvaluate [
648-
<timeout: 50 "seconds">
654+
"seconds"
655+
656+
<timeout: 50>
649657
| emax emin leadingOne significands |
650-
significands := 0 to: 1<<10-1.
651-
leadingOne := 1<<10.
658+
significands := 0 to: (1 << 10) - 1.
659+
leadingOne := 1 << 10.
652660
emin := -14.
653661
emax := 15.
654-
662+
655663
"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-
664+
emin to: emax do: [ :e |
665+
significands
666+
do: [ :s |
667+
| f |
668+
f := (leadingOne + s asArbitraryPrecisionFloatNumBits: 11)
669+
timesTwoPower: e - 10.
670+
self
671+
assert: (Smalltalk compiler evaluate: f storeString)
672+
equals: f.
673+
self
674+
assert: (Smalltalk compiler evaluate: f printString)
675+
equals: f ] ].
676+
663677
"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].
678+
significands
679+
do: [ :s |
680+
| f |
681+
f := (s asArbitraryPrecisionFloatNumBits: s highBit)
682+
timesTwoPower: emin - 10.
683+
self assert: (Smalltalk compiler evaluate: f storeString) equals: f.
684+
self assert: (Smalltalk compiler evaluate: f printString) equals: f ]
669685
]
670686

671687
{ #category : #'testing-arithmetic' }

0 commit comments

Comments
 (0)