Those on 64-bit systems can replicate this bug with abs(2^63) or 
abs(-9223372036854775808).

The issue here is that the number 2^31 overflows the Int32 type to -(2^31). 
The fact that it returns itself is somewhat coincidental.

This is probably a bug, but there are sometimes reasons for allowing 
overflow.

On Wednesday, 12 February 2014 09:56:15 UTC-6, MikeEI wrote:
>
> abs(-2147483648) results in -2147483648 ???
>
> @which(abs(-2147483648)) results in
> abs(x::Signed) at intfuncs.jl:29
>
> Shouldn't the type system promote to Int64 as there is no corresponding 
> Int32 value or indicate error?
>
> Just a newcomers/learners question.
>
> P.S.: Using version 0.2.0 (2013-11-16) on Linux Mint 32 bit system.
>

Reply via email to