We probably need a thorough FAQ entry on this subject. I've probably done
some explanation before, but it bears writing it somewhere more permanent.


On Wed, Jan 15, 2014 at 3:17 AM, Tobias Knopp
<[email protected]>wrote:

> @Stefan: Is there a good reason to promote Int32 operations to the native
> mashine type? Sorry, if this has already discussed in depth. But for me it
> feals wrong to automatically upcast integer operations. I think that the
> type should keep stable and that this is more important than overflow
> issues.
>
> Python promotes this also to int32 by the way
>
> Am Mittwoch, 15. Januar 2014 04:09:37 UTC+1 schrieb Andy M:
>
>> On Wednesday, 15 January 2014 01:44:32 UTC, Stefan Karpinski wrote:
>>>
>>> It's difficult to use 32-bit integer arithmetic in Julia on a 64-bit
>>> machine, but you usually don't want to. It's sometimes a performance hit
>>> like it is here, but that's pretty rare, and 2 billion really just isn't
>>> big enough for a lot of pretty mundane things you might use integers for
>>> (Bill Gates can't represent their net worth with a 32-bit int!).
>>>
>>
>> I can see the sense in that, but couldn't you argue that if someone has
>> explicitly declared a 32-bit int, it is probably for performance reasons,
>> so they would probably prefer to think about the overflow issues in
>> exchange for the performance boost? It just seems strange to forbid an
>> operation that someone already has to opt into, especially when Julia is
>> aiming to support highly optimized libraries with tight loops like the one
>> benchmarked above.
>>
>> Though I suppose it would be a bit difficult to deal with the interaction
>> between integer literals and 32 bit operations, without causing lots of
>> accidental type promotion.
>>
>

Reply via email to