File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ n_significant_bits(::Type{Float8_4}) = 3
3232bias (:: Type{Float8} ) = 3
3333bias (:: Type{Float8_4} ) = 7
3434
35- eps (:: Type{Float8} ) = Float8 ( 0x02 )
36- eps (:: Type{Float8_4 } ) = Float8_4 ( 0x20 )
35+ eps (x :: AbstractFloat8 ) = max (x - prevfloat (x), nextfloat (x) - x )
36+ eps (:: Type{T } ) where T <: AbstractFloat8 = eps ( one (T) )
3737
3838# define inifinities and nan
3939inf8 (:: Type{Float8} ) = Float8 (0x70 )
Original file line number Diff line number Diff line change 251251 @test Inf8_4 == nextfloat (Inf8_4)
252252 @test - floatmax (Float8_4) == nextfloat (- Inf8_4)
253253
254- @test eps (Float8) == nextfloat (Float8 (1 )) - Float8 (1 )
254+ for T in (Float8, Float8_4)
255+ @test eps (T) == nextfloat (T (1 )) - T (1 )
256+ @test eps (one (T)) == eps (T)
257+ end
255258end
256259
257260@testset " Prevfloat" begin
You can’t perform that action at this time.
0 commit comments