Yes, actually. If you're on a 64 bit machine, then the integer literal "0" 
is an Int64. So int64(0) - 0x12345678 promotes and does the subtraction in 
Int64. -0x12345678 wraps around to the unsigned integer 0xedcba988 which is 
greater than typemax(Int32). So the value is too large to represent as a 
signed Int32.


On Monday, January 5, 2015 5:43:20 PM UTC-8, Chi-wei Wang wrote:
>
>
>
> julia version 0.4.0-dev+2496
>
> Program:
> println(-0x12345678)
> println(0-0x12345678)
> println(int32(0-0x12345678))
> println(int32(-0x12345678))
>
>
> Output:
> 3989547400
> -305419896
> -305419896
> ERROR: InexactError()
>  in include at ./boot.jl:248
>  in include_from_node1 at loading.jl:128
>  in process_options at ./client.jl:312
>  in _start at ./client.jl:393
> while loading /home/jack/julia/jia32/test.jl, in expression starting on 
> line 4
>
>
> Can this be right?
>

Reply via email to