On Tue, Apr 5, 2016 at 10:50 AM, Páll Haraldsson
<pall.haralds...@gmail.com> wrote:
> On Tuesday, April 5, 2016 at 2:45:38 PM UTC, Didier Verna wrote:
>>
>>
>>   Hello,
>>
>> the manual says: "In Julia, exceeding the maximum representable value of
>> a given type results in a wraparound behavior:", but that seems to be
>> the case only for the native type and above:
>>
>> julia> typeof(typemax(Int64)  + 1) -> Int64
>> julia> typeof(typemax(Int128) + 1) -> Int128
>>
>> but:
>>
>> julia> typeof(typemax(Int8)   + 1) -> Int64
>> julia> typeof(typemax(Int16)  + 1) -> Int64
>> julia> typeof(typemax(Int32)  + 1) -> Int64
>
>
> Right, the manual could be updated, I guess. The last one, gives you Int32
> on 32-bit platforms. This i all intentional. Then there is Int128 and BigInt
> (no modular there).

`Int128` does use modulus semantics.

-erik

>> These last 3 results seem inconsistent (and the manual incorrect)
>> because for example, typeof(typemax(Int8)) -> Int8 and not Int64, so no,
>> Julia doesn't do modular arithmetics all the time.
>>
>> --
>> Resistance is futile. You will be jazzimilated.
>>
>> Lisp, Jazz, Aïkido: http://www.didierverna.info


-- 
Erik Schnetter <schnet...@gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/

Reply via email to