In general, Julia doesn't do automatic type promotion. When Julia does automatic promotion, it discourages the use of type promotion that depends on values (i.e. a specific number) rather than types. This restriction is part of the reason the type system can work effectively.
In this case, the Julia restriction to types rather than values means that, were abs to promote to Int64, it would have to promote all Int32 values to Int64, not just a few of them. Hope that helps make this easier to understand. -- John On Feb 12, 2014, at 7:56 AM, [email protected] 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.
