@@ -8,6 +8,11 @@ if VERSION >= v"0.7.0-alpha.69"
8
8
using SpecialFunctions
9
9
end
10
10
11
+ if ! isdefined (Base, :floatmax )
12
+ floatmax (x) = realmax (x)
13
+ floatmin (x) = realmin (x)
14
+ end
15
+
11
16
12
17
@test unsafe_load (DecFP. flags[]) == 0
13
18
@@ -20,21 +25,21 @@ for T in (Dec32, Dec64, Dec128)
20
25
if T == Dec32
21
26
@test d32 " 3.2" * d32 " 4.5" == d32 " 14.4"
22
27
@test eps (Dec32) == parse (Dec32, " 1e-6" )
23
- @test realmax (Dec32) == parse (Dec32, " +9999999E+90" )
24
- @test realmin (Dec32) == parse (Dec32, " +1E-101" )
28
+ @test floatmax (Dec32) == parse (Dec32, " +9999999E+90" )
29
+ @test floatmin (Dec32) == parse (Dec32, " +1E-101" )
25
30
@test bswap (Dec32 (1.5 )) == reinterpret (Dec32, bswap (reinterpret (UInt32, Dec32 (1.5 ))))
26
31
elseif T == Dec64
27
32
@test d " 3.2" * d " 4.5" == d " 14.4"
28
33
@test d64 " 3.2" * d64 " 4.5" == d64 " 14.4"
29
34
@test eps (Dec64) == parse (Dec64, " 1e-15" )
30
- @test realmax (Dec64) == parse (Dec64, " +9999999999999999E+369" )
31
- @test realmin (Dec64) == parse (Dec64, " +1E-398" )
35
+ @test floatmax (Dec64) == parse (Dec64, " +9999999999999999E+369" )
36
+ @test floatmin (Dec64) == parse (Dec64, " +1E-398" )
32
37
@test bswap (Dec64 (1.5 )) == reinterpret (Dec64, bswap (reinterpret (UInt64, Dec64 (1.5 ))))
33
38
else
34
39
@test d128 " 3.2" * d128 " 4.5" == d128 " 14.4"
35
40
@test eps (Dec128) == parse (Dec128, " 1e-33" )
36
- @test realmax (Dec128) == parse (Dec128, " +9999999999999999999999999999999999E+6111" )
37
- @test realmin (Dec128) == parse (Dec128, " +1E-6176" )
41
+ @test floatmax (Dec128) == parse (Dec128, " +9999999999999999999999999999999999E+6111" )
42
+ @test floatmin (Dec128) == parse (Dec128, " +1E-6176" )
38
43
@test bswap (Dec128 (1.5 )) == reinterpret (Dec128, bswap (reinterpret (UInt128, Dec128 (1.5 ))))
39
44
end
40
45
@@ -172,9 +177,9 @@ for T in (Dec32, Dec64, Dec128)
172
177
@test round (Ti, T (2.5 ), RoundNearestTiesAway) === round (Ti, T (3.3 ), RoundNearestTiesAway) === Ti (3 )
173
178
@test round (Ti, T (2.5 ), RoundNearestTiesUp) === round (Ti, T (3.3 ), RoundNearestTiesUp) === Ti (3 )
174
179
@test_throws InexactError convert (Ti, xd)
175
- @test_throws InexactError trunc (Ti, realmax (T))
176
- @test_throws InexactError floor (Ti, realmax (T))
177
- @test_throws InexactError ceil (Ti, realmax (T))
180
+ @test_throws InexactError trunc (Ti, floatmax (T))
181
+ @test_throws InexactError floor (Ti, floatmax (T))
182
+ @test_throws InexactError ceil (Ti, floatmax (T))
178
183
if Ti <: Signed
179
184
@test parse (T, " -17" ) == T (Ti (- 17 )) == Ti (- 17 ) == Ti (T (- 17 ))
180
185
end
0 commit comments