Link Search Menu Expand Document

Fraction

fraction.ts#L11

Class Fraction

Fraction class.

constructor (n: number, d: number): Fraction

Name Type Default Description
n number    
d number 1  

Property .d : number

Default value: 1

Property .n : number

Accessor .decimal : number

Accessor .inverse : Fraction

Accessor .sign

Accessor .simplified : Fraction

Method .add (a: number|Fraction): Fraction

Name Type Default Description  
a number Fraction    

Method .divide (a: number|Fraction): Fraction

Name Type Default Description  
a number Fraction    

Method .multiply (a: number|Fraction): Fraction

Name Type Default Description  
a number Fraction    

Method .subtract (a: number|Fraction): Fraction

Name Type Default Description  
a number Fraction    

Method .toMathML (): string

Method .toString (): string

static Method .difference (a: number|Fraction, b: number|Fraction): Fraction

Calculates the difference of two fractions a and b.

Name Type Default Description  
a number Fraction    
b number Fraction    

static Method .fromDecimal (x: number, max: number): Fraction

Name Type Default Description
x number    
max number 20  

static Method .product (a: number|Fraction, b: number|Fraction): Fraction

Calculates the product of two fractions a and b.

Name Type Default Description  
a number Fraction    
b number Fraction    

static Method .quotient (a: number|Fraction, b: number|Fraction): Fraction

Calculates the quotient of two fractions a and b.

Name Type Default Description  
a number Fraction    
b number Fraction    

static Method .sum (a: number|Fraction, b: number|Fraction): Fraction

Calculates the sum of two fractions a and b.

Name Type Default Description  
a number Fraction    
b number Fraction    

Copyright © 2021 Mathigon.org