tinymist_std::typst::foundations::calc

Function div_euclid

pub fn div_euclid(
    span: Span,
    dividend: DecNum,
    divisor: Spanned<DecNum>,
) -> Result<DecNum, EcoVec<SourceDiagnostic>>
Expand description

Performs euclidean division of two numbers.

The result of this computation is that of a division rounded to the integer {n} such that the dividend is greater than or equal to {n} times the divisor.

#calc.div-euclid(7, 3) \
#calc.div-euclid(7, -3) \
#calc.div-euclid(-7, 3) \
#calc.div-euclid(-7, -3) \
#calc.div-euclid(1.75, 0.5) \
#calc.div-euclid(decimal("1.75"), decimal("0.5"))