# divrem

divrem(x, y)

The quotient and remainder from Euclidean division. Equivalent to `(xÃ·y, x%y)`.

## Examples

1. Calculate quotient and remainder:

``````julia> divrem(17, 5)
(3, 2)``````

This example calculates the quotient and remainder of 17 divided by 5. The quotient is 3, and the remainder is 2.

2. Handle negative numbers:

``````julia> divrem(-10, 3)
(-3, -1)``````

It handles negative numbers correctly. In this example, -10 divided by 3 gives a quotient of -3 and a remainder of -1.

3. Divide by zero:

``````julia> divrem(10, 0)
ERROR: DivideError: integer division error``````

When dividing by zero, it throws a `DivideError` indicating an integer division error.

4. Divide non-integer values:
``````julia> divrem(10.5, 2.2)
(4.0, 2.0999999999999996)``````

The `divrem` function can also be used to divide non-integer values. In this example, 10.5 divided by 2.2 gives a quotient of 4.0 and a remainder of 2.0999999999999996.

Common mistake example:

``````julia> divrem(10, "2")
ERROR: MethodError: no method matching divrem(::Int64, ::String)``````

In this example, the function is called with non-numeric arguments. The `divrem` function expects numeric arguments, so make sure to provide appropriate numerical values to avoid such errors.

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,

## User Contributed Notes

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: