On Sunday, October 18, 2015 at 3:42:57 PM UTC+10, Uliano Guerrini wrote:
>
> Thanks to the pointers given I dug a little bit under the hood ad found 
> the promising unbox intrinsic function. It would exactly be what I was 
> looking for but it seems to work only one way:
>
> *julia> **using Base.Intrinsics*
>
>
> *julia> **theFloat=1.0*
>
> *1.0*
>
>
> *julia> **b=unbox(Int64,theFloat)*
>
> *4607182418800017408*
>
>
> *julia> **bits(theFloat)*
>
> *"0011111111110000000000000000000000000000000000000000000000000000"*
>
>
> *julia> **type Words2x32*
>
> *         lo::Int32*
>
> *         hi::Int32*
>
> *       end*
>
>
> *julia> **c=Words2x32(0,1072693248)*
>
> *Words2x32(0,1072693248)*
>
>
> *julia> **d=unbox(Float64,c)*
>
> *1.0*
>
>
> *julia> **bits(d)*
>
> *"0011111111110000000000000000000000000000000000000000000000000000"*
>
>
> *julia> **e=unbox(Words2x32,d)*
>
> *Segmentation fault: 11*
>
>
> *Is it a bug or I have used the function in an unexpected way?*
>


You can't unbox an already unboxed object.

Cheers
Lex 

Reply via email to