In [1]:
using Unums
In [2]:
# create a vector of all exact unums with positive sign bit
E = Array(Unum22,0)
for es in 1:2^2
for fs in 1:2^2
for e = 0:(2^es-1)
for f = 0:(2^fs-1)
u = Unum22(false,e,f,false,es,fs) # set s and u bits to false
push!(E,u)
end
end
end
end
E
Out[2]:
In [3]:
# All exact 2,2 unums can be represented by a Float64
F = [convert(Float64,x) for x in E]
Fu = unique(F)
sort!(Fu)
Out[3]:
In [4]:
R = [convert(Rational{Int},x) for x in E]
Ru = unique(R)
sort!(Ru)
Out[4]:
In [5]:
# number of zeros
sum(F .== 0)
Out[5]:
In [ ]: