Dextrin.Rational (Dextrin v0.1.0)

Copy Markdown View Source

DXN rational (int/uint) — an exact ratio, stored exactly as given and never silently reduced: 22/7 and 44/14 are distinct DXN values (DXN.md calls it "exact ratio," not "exact reduced ratio"), so reducing on parse would be a silent, opinionated transformation. reduce/1 is offered but never called implicitly.

Summary

Types

t()

@type t() :: %Dextrin.Rational{denominator: pos_integer(), numerator: integer()}

Functions

new(numerator, denominator)

@spec new(integer(), pos_integer()) :: t()

reduce(rational)

@spec reduce(t()) :: t()