I want a function like frexp, but that returns an integer (of the same size of the floating point) and an exponent. Currently I have tried the following implementation:

julia> inexp(x::T) where T <: Base.Math.IEEEFloat = begin
m, ex = frexp(x)
b = Base.Math.significand_bits(T)
mi = trunc(Integer, m * exp2(b))
return mi, ex - b
end
inexp (generic function with 1 method)
julia> inexp(2.3)
(2589569785738035, -50)

I am not too familiar with floating points, so I wonder if there anything I should look out for that I am not handling properly in my implementation here.

This seems to always return Int, not â€śintegers of the same size of the floating pointâ€ť.

Also, I think youâ€™re losing one bit of the significand. For positive, non-denormal, non-NaN, non-Inf, this will give your mi shifted one step left, and with one more bit of information.