julia> a = [1.0]
1-element Array{Float64,1}:
 1.0

julia> b = reinterpret(UInt8, a)
8-element Array{UInt8,1}:
 0x00
 0x00
 0x00
 0x00
 0x00
 0x00
 0xf0
 0x3f

julia> c = reinterpret(Float64, b)
1-element Array{Float64,1}:
 1.0



On Saturday, October 17, 2015 at 6:04:14 PM UTC+2, Uliano Guerrini wrote:
>
> I don't see the point of passing through a string like this:
>
> *julia> **hex2bytes(num2hex(1.0))*
>
> *8-element Array{UInt8,1}:*
>
> * 0x3f*
>
> * 0xf0*
>
> * 0x00*
>
> * 0x00*
>
> * 0x00*
>
> * 0x00*
>
> * 0x00*
> * 0x00* 
>
> I assume that the intermediate passage slows down the conversion.
>
> Same question for the way back from binary to float.
>
>
>

Reply via email to