divMod -package:numeric-prelude
simultaneous
div and
mod.
WARNING: This function is partial (because it throws when 0 is passed
as the divisor) for all the integer types in
base.
hedgehog Hedgehog.Internal.Prelude,
base-compat Prelude.Compat,
protolude Protolude Protolude.Base,
relude Relude.Numeric,
Cabal-syntax Distribution.Compat.Prelude,
ihaskell IHaskellPrelude,
ghc-lib-parser GHC.Prelude.Basic,
dimensional Numeric.Units.Dimensional.Prelude,
rebase Rebase.Prelude,
xmonad-contrib XMonad.Config.Prime,
copilot-language Copilot.Language.Prelude,
LambdaHack Game.LambdaHack.Core.Prelude,
cabal-install-solver Distribution.Solver.Compat.Prelude,
faktory Faktory.Prelude,
hledger-web Hledger.Web.Import simultaneous
div and
mod
WARNING: This function is partial (because it throws when 0 is passed
as the divisor) for all the integer types in
base.
The quotient and remainder of a type-level integer and a natural
number. For a negative dividend, the remainder part is positive such
that x = q*y + r @since 0.1.4
Used to implement
divMod for the
Integral typeclass.
This gives a tuple equivalent to
(div x y, mod x y)
Example
>>> divModInt 10 2
(5,0)
>>> divMod 10 2
(5,0)
Used to implement
divMod for the
Integral typeclass.
This gives a tuple equivalent to
(div x y, mod x y)
Example
>>> divModInteger 10 2
(5,0)
>>> divMod 10 2
(5,0)
Simultaneous
divInteger and
modInteger.
Divisor must be non-zero otherwise the GHC runtime will terminate with
a division-by-zero fault.
Used to implement
divMod for the
Integral typeclass.
This gives a tuple equivalent to
(div x y, mod x y)
Example
>>> divModInt 10 2
(5,0)
>>> divMod 10 2
(5,0)
Perform a pointwise integer division with modulo where first array
contains numerators and the second one denominators
divModA arr1 arr2 == zipWith divMod arr1 arr2
- Partial Mismatched array sizes will result in an impure
exception being thrown.
Approximate
divMod for fields.
>>> divModF 1.5 1.2
(1.0,0.30000000000000004)