Hi Simon,

Simon Danisch <sdani...@gmail.com> writes:

> I'm guessing that is done to prevent overflow.
> So you need to use your own implementation.
> Here are the promote rules defining this behavior: 
> https://github.com/JuliaLang/julia/blob/master/base/reduce.jl#L32
> So in theory you could also implement your own Int type, that has a
> different promote behavior. Probably not worth it, though ;)

OK, thanks, I will check reduce.jl, I was just finding odd how the
promotion happens for some integer types and not others...

,----
| julia> typeof(sum([i for i in Int8(1):Int8(10)]))    
| Int32
| 
| julia> typeof(sum([i for i in Int16(1):Int16(10)]))                           
                                                                                
       
| Int32
| 
| julia> typeof(sum([i for i in Int32(1):Int32(10)]))                           
                                                                                
                                      
| Int64
| 
| julia> typeof(sum([i for i in Int64(1):Int64(10)]))                           
                                                                                
                                       
| Int64                                                                         
                                                                                
                                                  
| 
| julia> typeof(sum([i for i in Int128(1):Int128(10)]))                         
                                                                                
           
| Int128    
`----

-- 
Ángel de Vicente
http://www.iac.es/galeria/angelv/          

Reply via email to