File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -66,19 +66,19 @@ const QuadrupleF16 = DoubleFloat{DoubleFloat{Float16}}
6666@inline  DoubleFloat (x:: Tuple{T,T} ) where  {T<: AbstractFloat } =  DoubleFloat {T} (x[1 ], x[2 ])
6767
6868@inline  function  Double64 (x:: T ) where  {T<: IEEEFloat }
69-     ! isfinite (x) &&  return (Double64 (Float64 (x),zero (T )))
69+     ! isfinite (x) &&  return (DoubleFloat (Float64 (x),Float64 ( NaN )))
7070    hi =  Float64 (x)
7171    lo =  Float64 (x -  Float64 (hi))
7272    return  Double64 (hi, lo)
7373end 
7474@inline  function  Double32 (x:: T ) where  {T<: IEEEFloat }
75-     ! isfinite (x) &&  return (Double32 (Float32 (x),zero (T )))
75+     ! isfinite (x) &&  return (DoubleFloat (Float32 (x),Float32 ( NaN )))
7676    hi =  Float32 (x)
7777    lo =  Float32 (x -  Float64 (hi))
7878    return  Double32 (hi, lo)
7979end 
8080@inline  function  Double16 (x:: T ) where  {T<: IEEEFloat }
81-     ! isfinite (x) &&  return (Double16 (Float16 (x),zero (T )))
81+     ! isfinite (x) &&  return (DoubleFloat (Float16 (x),Float16 ( NaN )))
8282    hi =  Float16 (x)
8383    lo =  Float16 (x -  Float64 (hi))
8484    return  Double16 (hi, lo)
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ using Random
5151
5252using  AccurateArithmetic
5353
54- include (" Double.jl" #  Double64, Double16 , Double16
54+ include (" Double.jl" #  Double64, Double32 , Double16
5555
5656include (" doubletriple/double.jl" 
5757include (" doubletriple/double_consts.jl" 
Original file line number Diff line number Diff line change 99#  Double16 is a special case
1010@test  isinteger (maxintfloat (Double16))
1111@test  maxintfloat (Double16) ==  floatmax (Double16)
12+ 
13+ 
14+ @testset  " Inf and NaN generation $T " for  T in  (Double16, Double32, Double64)
15+     @test  T (Inf ) ==  inf (T)
16+     @test  T (Inf ) ==  posinf (T)
17+     @test  T (- Inf ) ==  neginf (T)
18+     @test  T (NaN ) ==  nan (T)
19+ 
20+     @test  T (Inf32 ) ==  inf (T)
21+     @test  T (Inf32 ) ==  posinf (T)
22+     @test  T (- Inf32 ) ==  neginf (T)
23+     @test  T (NaN32 ) ==  nan (T)
24+ 
25+     @test  T (Inf16 ) ==  inf (T)
26+     @test  T (Inf16 ) ==  posinf (T)
27+     @test  T (- Inf16 ) ==  neginf (T)
28+     @test  T (NaN16 ) ==  nan (T)
29+ end 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments