simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

fraction.d.ts (1826B)


      1 declare module 'Fraction';
      2 
      3 export interface NumeratorDenominator {
      4   n: number;
      5   d: number;
      6 }
      7 
      8 type FractionConstructor = {
      9   (fraction: Fraction): Fraction;
     10   (num: number | string): Fraction;
     11   (numerator: number, denominator: number): Fraction;
     12   (numbers: [number | string, number | string]): Fraction;
     13   (fraction: NumeratorDenominator): Fraction;
     14   (firstValue: Fraction | number | string | [number | string, number | string] | NumeratorDenominator, secondValue?: number): Fraction;
     15 };
     16 
     17 export default class Fraction {
     18   constructor (fraction: Fraction);
     19   constructor (num: number | string);
     20   constructor (numerator: number, denominator: number);
     21   constructor (numbers: [number | string, number | string]);
     22   constructor (fraction: NumeratorDenominator);
     23   constructor (firstValue: Fraction | number | string | [number | string, number | string] | NumeratorDenominator, secondValue?: number);
     24 
     25   s: number;
     26   n: number;
     27   d: number;
     28 
     29   abs(): Fraction;
     30   neg(): Fraction;
     31 
     32   add: FractionConstructor;
     33   sub: FractionConstructor;
     34   mul: FractionConstructor;
     35   div: FractionConstructor;
     36   pow: FractionConstructor;
     37   gcd: FractionConstructor;
     38   lcm: FractionConstructor;
     39   
     40   mod(n?: number | string | Fraction): Fraction;
     41 
     42   ceil(places?: number): Fraction;
     43   floor(places?: number): Fraction;
     44   round(places?: number): Fraction;
     45 
     46   inverse(): Fraction;
     47   
     48   simplify(eps?: number): Fraction;
     49   
     50   equals(n: number | string | Fraction): boolean;
     51   compare(n: number | string | Fraction): number;
     52   divisible(n: number | string | Fraction): boolean;
     53   
     54   valueOf(): number;
     55   toString(decimalPlaces?: number): string;
     56   toLatex(excludeWhole?: boolean): string;
     57   toFraction(excludeWhole?: boolean): string;
     58   toContinued(): number[];
     59   clone(): Fraction;
     60 }