This is a difficult problem at the algorithmic level. Here is a way to do this in Julia (to check your own solution):
function reversebitstring(::Type{T}, str::String) where {T<:Base.IEEEFloat} unsignedbits = Meta.parse(string("0b", str)) thefloat = reinterpret(T, unsignedbits) return thefloat end
reversebitstring(Float64, "0100000001011110110111010010111100011010100111111011111001110111")
julia> bitstring(3.141592653589793238462643) "0100000000001001001000011111101101010100010001000010110100011000" julia> reversebitstring(Float64, ans) 3.141592653589793 julia> pi π = 3.1415926535897... julia> 1.0*pi 3.141592653589793