Function in num coil-stdlib

div_euclid

fn div_euclid(int a, int b) -> int
Import
use num::{div_euclid};
Source: src/num.hy

Returns the quotient that goes with rem_euclid: a == div_euclid(a, b) * b + rem_euclid(a, b).

Parameters#

NameType
aint
bint

Returns#

int

Examples#

use num::{div_euclid};
use tests::assert;
assert!(div_euclid(-7, 3) == -3);

See also#

  • num::rem_euclid
  • abs: Returns the absolute value of x.
  • min: Returns the smaller of a and b (a when they are equal).
  • max: Returns the larger of a and b (a when they are equal).
  • round: Rounds x to the nearest whole number; halves round away from zero.
  • clamp: Returns x limited to the range lo..=hi.
  • signum: Returns -1, 0 or 1 by the sign of x.
  • gcd: Returns the greatest common divisor of a and b, which should be non-negative.
↑ ↓ navigate ↵ open