Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/rimbu/typical/num.ts>Div

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias Div
import { type Div } from "https://deno.land/x/rimbu@1.0.2/typical/num.ts";

Returns the result of dividing the first given natural number by the second.

Examples

Example 1

Div<0, 0> => never
Div<9, 3> => 3
Div<14, 5> => 2

Type Parameters

N1 extends number
N2 extends number
definition: N2 extends 0 ? never : N1 extends 0 ? 0 : N1 extends N2 ? 1 : StrNum.ToNumber<StrNum.Divide<StrNum.FromNumber<N1>, StrNum.FromNumber<N2>>[0]>