File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ Convert `x` to an extended precision `Double64`.
105
105
lo = Float64 (x - Float64 (hi))
106
106
else
107
107
hi = Float64 (x)
108
- lo = NaN
108
+ lo = hi
109
109
end
110
110
return Double64 (hi, lo)
111
111
end
@@ -120,7 +120,7 @@ Convert `x` to an extended precision `Double32`.
120
120
lo = Float32 (x - Float32 (hi))
121
121
else
122
122
hi = Float32 (x)
123
- lo = NaN32
123
+ lo = hi
124
124
end
125
125
return Double32 (hi, lo)
126
126
end
@@ -136,7 +136,7 @@ Convert `x` to an extended precision `Double16`.
136
136
lo = Float16 (x - Float16 (hi))
137
137
else
138
138
hi = Float16 (x)
139
- lo = NaN16
139
+ lo = hi
140
140
end
141
141
return Double16 (hi, lo)
142
142
end
Original file line number Diff line number Diff line change 29
29
@testset " Inf and NaN layout $T " for T in (Double16, Double32, Double64)
30
30
@test isinf (HI (T (Inf )))
31
31
@test isnan (HI (T (NaN )))
32
- @test isnan (LO (T (Inf )))
32
+ @test isinf (LO (T (Inf )))
33
33
@test isnan (LO (T (NaN )))
34
34
end
35
35
36
+ @testset " Inf and NaN conversion" for T in (Double16, Double32, Double64)
37
+ for S in (BigFloat, Float128)
38
+ @test isnan (S (T (NaN )))
39
+ @test isinf (S (T (Inf )))
40
+ @test S (T (Inf )) > 0
41
+ @test isinf (S (T (- Inf )))
42
+ @test S (T (- Inf )) < 0
43
+ @test isnan (T (S (NaN )))
44
+ @test isinf (T (S (Inf )))
45
+ @test T (S (Inf )) > 0
46
+ @test isinf (T (S (- Inf )))
47
+ @test T (S (- Inf )) < 0
48
+ end
49
+ end
50
+
36
51
@testset " NaNs $T " for T in (Double16, Double32, Double64)
37
52
@test isnan (exp (T (NaN )))
38
53
@test isnan (log (T (NaN )))
You can’t perform that action at this time.
0 commit comments