tinymist_std::typst::foundations::calc

Function rem

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

Calculates the remainder of two numbers.

The value calc.rem(x, y) always has the same sign as x, and is smaller in magnitude than y.

This can error if given a [decimal] input and the dividend is too small in magnitude compared to the divisor.

#calc.rem(7, 3) \
#calc.rem(7, -3) \
#calc.rem(-7, 3) \
#calc.rem(-7, -3) \
#calc.rem(1.75, 0.5)