# A plea for int overflow checking as the default

**URL:** <https://discourse.julialang.org/t/a-plea-for-int-overflow-checking-as-the-default/3338>\
**Category:** Internals & Design\
**Tags:** question, proposal, integer-overflow\
**Created:** [April 22, 2017, 3:49pm UTC](https://discourse.julialang.org/t/a-plea-for-int-overflow-checking-as-the-default/3338 "2017-04-22T15:49:16Z")\
**Posts on this page:** 1\
**Showing post:** 65

<div class="post-metadata">

**Author:** ![Jean\_Michel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jean_michel/32/8282_2.png) [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Post date:** [February 19, 2018, 11:12pm UTC](https://discourse.julialang.org/t/a-plea-for-int-overflow-checking-as-the-default/3338/65 "2018-02-19T23:12:35Z")

</div>

Hello, I have a small problem with SaferIntegers, still using the same code:

```
 function collatz(lim)
    max=1
    for i in 1:lim
      c=0
      n=SafeUInt64(i)
      while n!=1
        if n&1==0 n>>=1
        else n=3*n+1
        end
        c+=1
      end
      if c>max
        max=c
        println("at $i new max=$max")
      end
    end
  end

  collatz(1000)

 ERROR: MethodError: >>(::SaferIntegers.SafeUInt64, ::Int64) is ambiguous. Candidates:

```

> > (x::T1, y::T2) where {T2\<:Integer, T1\<:SaferIntegers.SafeInteger} in SaferIntegers at /home/jmichel/.julia/v0.6/SaferIntegers/src/binary\_ops.jl:54  
> > (x::Integer, c::Int64) in Base at operators.jl:528  
> > Possible fix, define  
> > (::T1\<:SaferIntegers.SafeInteger, ::Int64)  
> > Stacktrace:  
> > [1] collatz(::Int64) at /home/jmichel/collatz.jl:7

---

_[View the full topic](https://discourse.julialang.org/t/a-plea-for-int-overflow-checking-as-the-default/3338)._
