What if numeric literals acted the same way as irrational numbers like pi,
and automatically adapted to the environment where they are used?
I know that that sort of rule would have made a lot of the bit twiddling
code a lot simpler than having to worry that 0xff and 0x1ff,
or
On Tue, Apr 5, 2016 at 11:05 AM, Didier Verna wrote:
> Erik Schnetter wrote:
>
>> The literal `1` has type `Int`. The promotion rules for `Int8` and
>> `Int` state that, before the addition, `Int8` is converted to `Int`.
>> (On your system, it seems
Erik Schnetter wrote:
> The literal `1` has type `Int`. The promotion rules for `Int8` and
> `Int` state that, before the addition, `Int8` is converted to `Int`.
> (On your system, it seems that `Int` is `Int64`.)
OK, so indeed, there's modular arithmetics for the non
On Tue, Apr 5, 2016 at 10:45 AM, 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>
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: