       Fraction.normalized n.neg(), d.neg()
     else
       a = num.gcd n, d
-      new Fraction n.div(a), d.div(a)
+      new Fraction n.idiv(a), d.idiv(a)
 
   neg__: -> new Fraction @numer.neg(), @denom
   abs__: -> new Fraction @numer.abs(), @denom


  times__: (x) -> new LongInt @sign * x.sign, mul @digits, x.digits

  divmod = (r, s) ->
    return [ZERO, ZERO] unless cleanup r

    scale = Math.floor BASE / (s.last() + 1)


  cleanup = (s) -> s?.reverse()?.dropWhile((x) -> x == 0)?.reverse() or null

  isqrt = (s) ->
    n = s.size()
    step = (r) ->
      rn = seq idiv(add(r, idiv(s, r)), seq([2]))
      if cmp(r, rn) then -> step(rn) else rn
    bounce step s.take n >> 1

  isqrt__: ->
    if @isZero()
      asNum 0
    else if @isPos()
      new LongInt 1, isqrt @digits
    else
      throw new Error "expected a non-negative number, got #{this}"

