In [60]:
function decode_Float64(x::Float64)
    s = bits(x)
    sgn = parse(Int,s[1],2)
    e = parse(Int,s[2:12],2)
    f = parse(Int,s[13:64],2)
    ffrac = f/2^52
    
    ebias = 1023
    
    fstr = (@sprintf( "%.17f", ffrac) )[3:end]
    
    if e == 0
        println( @sprintf(" (-1)^(%i) x 2^(%i) x 0.%s = %g ", sgn, 1-ebias, fstr, x) )
    elseif e == 2^11 - 1
        println( @sprintf(" (-1)^(%i) x 2^(Inf) x 1.%s = %g ", sgn, fstr, x) )
    else
        println( @sprintf(" (-1)^(%i) x 2^(%i) x 1.%s = %g ", sgn, e-ebias, fstr, x) )
    end
end

decode_Float64(Inf)
decode_Float64(NaN)
decode_Float64(0./0.)
decode_Float64(-Inf)
decode_Float64(-Inf + Inf)
decode_Float64(reinterpret(Float64,0x000fffffffffffff))
decode_Float64(1.)
decode_Float64(nextfloat(1.))
decode_Float64(prevfloat(1.))
decode_Float64(-prevfloat(1.))
 (-1)^(0) x 2^(Inf) x 1.00000000000000000 = Inf 
 (-1)^(0) x 2^(Inf) x 1.50000000000000000 = NaN 
 (-1)^(1) x 2^(Inf) x 1.50000000000000000 = NaN 
 (-1)^(1) x 2^(Inf) x 1.00000000000000000 = -Inf 
 (-1)^(1) x 2^(Inf) x 1.50000000000000000 = NaN 
 (-1)^(0) x 2^(-1022) x 0.99999999999999978 = 2.22507e-308 
 (-1)^(0) x 2^(0) x 1.00000000000000000 = 1  
 (-1)^(0) x 2^(0) x 1.00000000000000022 = 1  
 (-1)^(0) x 2^(-1) x 1.99999999999999978 = 1  
 (-1)^(1) x 2^(-1) x 1.99999999999999978 = -1  
In [ ]:
In [53]:
set_bigfloat_precision(3)
set_rounding(BigFloat,RoundDown)
x = big"1.0"
for i=1:25
    x = nextfloat(x)
    @show x
end
x = 1.2
x = 1.5
x = 1.8
x = 2.0
x = 2.5
x = 3.0
x = 3.5
x = 4.0
x = 5.0
x = 6.0
x = 7.0
x = 8.0
x = 1.0e+01
x = 1.2e+01
x = 1.4e+01
x = 1.6e+01
x = 2.0e+01
x = 2.4e+01
x = 2.8e+01
x = 3.2e+01
x = 4.0e+01
x = 4.8e+01
x = 5.6e+01
x = 6.4e+01
x = 8.0e+01
In [63]:
decode_Float64(Inf - Inf)
 (-1)^(1) x 2^(Inf) x 1.50000000000000000 = NaN 
In [70]:
decode_Float64(1.)
decode_Float64(nextfloat(1.))
println( bits(1.) )
println(  bits(nextfloat(1.)) )

@show eps(1.)
@show 2.^(-52.)
 (-1)^(0) x 2^(0) x 1.00000000000000000 = 1  
Out[70]:
2.220446049250313e-16
 (-1)^(0) x 2^(0) x 1.00000000000000022 = 1  
0011111111110000000000000000000000000000000000000000000000000000
0011111111110000000000000000000000000000000000000000000000000001
eps(1.0) = 2.220446049250313e-16
2 .^ -52.0 = 2.220446049250313e-16