UNPKG

money-ts

Version:

TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals

25 lines (24 loc) 1.26 kB
import { Integer } from './Integer'; import { Natural } from './Natural'; import { NonZeroRational } from './NonZeroRational'; import { Setoid } from 'fp-ts/lib/Setoid'; import { Ord } from 'fp-ts/lib/Ord'; export declare type Rational = [Integer, Natural]; export declare function fromInteger(x: Integer): Rational; export declare function isZero(x: Rational): boolean; export declare function reduce(n: Integer, d: Natural): Rational; export declare function add([nx, dx]: Rational, [ny, dy]: Rational): Rational; export declare const zero: Rational; export declare function mul(x: Rational, y: Rational): Rational; export declare const one: Rational; export declare function negate(x: Rational): Rational; export declare function sub(x: Rational, y: Rational): Rational; export declare function div(x: Rational, y: NonZeroRational): Rational; export declare function sign(x: Rational): -1 | 0 | 1; export declare function floor(x: Rational): Integer; export declare function round(x: Rational): Integer; export declare function ceil(x: Rational): Integer; export declare function trunc(x: Rational): Integer; export declare const setoid: Setoid<Rational>; export declare const ord: Ord<Rational>; export declare const show: (x: [Integer, Natural]) => string;