div_euclid
fn div_euclid(int a, int b) -> int Import
Source: use num::{div_euclid}; src/num.hy Returns the quotient that goes with rem_euclid: a == div_euclid(a, b) * b + rem_euclid(a, b).
Parameters#
| Name | Type |
|---|---|
a | int |
b | int |
Returns#
int
Examples#
use num::{div_euclid};
use tests::assert;
assert!(div_euclid(-7, 3) == -3);
See also#
num::rem_euclidabs: Returns the absolute value ofx.min: Returns the smaller ofaandb(awhen they are equal).max: Returns the larger ofaandb(awhen they are equal).round: Roundsxto the nearest whole number; halves round away from zero.clamp: Returnsxlimited to the rangelo..=hi.signum: Returns-1,0or1by the sign ofx.gcd: Returns the greatest common divisor ofaandb, which should be non-negative.