On Sunday, December 7, 2014 5:08:45 PM UTC-8, [email protected] wrote:
>
>
>
> On Monday, December 8, 2014 10:21:52 AM UTC+10, Phil Tomson wrote:
>>
>> julia> typeof(-0b111)
>> Uint64
>>
>> julia> typeof(-7)
>> Int64
>>
>> julia> typeof(-0x7)
>> Uint64
>>
>> julia> typeof(-7)
>> Int64
>>
>> I find this a bit surprising. Why does the base of the number determine 
>> signed or unsigned-ness? Is this intentional or possibly a bug?
>>
>
> This is documented behaviour 
> http://docs.julialang.org/en/latest/manual/integers-and-floating-point-numbers/#integers
>  
> based on the heuristic that using hex is "mostly" in situations where you 
> need unsigned behaviour anyway.
>

The doc says: 

> This behavior is based on the observation that when one uses *unsigned 
> hex literals* for integer values, one typically is using them to 
> represent a fixed numeric byte sequence, rather than just an integer value.
>  
>

Hmm.... In the above cases they were signed hex literals. 

Reply via email to