new BigFraction()
Classes
Methods
abs() → {BigFraction}
Returns:
- Type
- BigFraction
acos() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
acosh() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
add(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
New Fraction instance
- Type
- BigFraction
asin() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
asinh() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
atan() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
atanh() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
cmp(b) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
-1 if less, 0 if equal, 1 if greater.
- Type
- number
cos() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
cosh() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
div(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
equals(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
exp() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
floor() → {BigFraction}
- Description:
Returns the floor of the fraction (largest integer <= value).
- Source:
Returns:
- Type
- BigFraction
isAlmostZero() → {boolean}
Returns:
- Type
- boolean
isNaN() → {boolean}
- Description:
Checks if the fraction is technically invalid (denominator was 0).
- Source:
Returns:
- Type
- boolean
isZero() → {boolean}
Returns:
- Type
- boolean
log() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
mul(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
neg() → {BigFraction}
Returns:
- Type
- BigFraction
operatorAdd(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
operatorDiv(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
operatorEqual(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
operatorGreater(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
operatorGreaterEqual(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
operatorLess(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
operatorLessEqual(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
operatorMul(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
operatorNeg() → {BigFraction}
Returns:
- Type
- BigFraction
operatorNotEqual(b) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- boolean
operatorPow(b) → {BigFraction|undefined}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
number | bigint | BigFraction |
Returns:
- Type
- BigFraction | undefined
operatorSub(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
pow(exponent) → {BigFraction|undefined}
Parameters:
| Name | Type | Description |
|---|---|---|
exponent |
number | bigint | BigFraction |
Returns:
- Type
- BigFraction | undefined
sin() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
sinh() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
sqrt() → {BigFraction|undefined}
- Description:
Returns the integer square root of the fraction (floor(sqrt(value))). Since BigInt arithmetic is integer based, exact rational roots are rare. This returns a Fraction representing the integer root.
- Source:
Returns:
- Type
- BigFraction | undefined
sub(b) → {BigFraction}
Parameters:
| Name | Type | Description |
|---|---|---|
b |
BigFraction | bigint | number | string |
Returns:
- Type
- BigFraction
tan() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
tanh() → {BigFraction|undefined}
Returns:
- Type
- BigFraction | undefined
toBigFloat() → {BigFloat}
Returns:
- Type
- BigFloat
toNumber() → {number}
- Description:
Converts to a standard JavaScript number (may lose precision).
- Source:
Returns:
- Type
- number
toString(radixopt, precopt, prettyopt) → {string}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
radix |
number |
<optional> |
10
|
|
prec |
number |
<optional> |
-1
|
precision digits in radix |
pretty |
boolean |
<optional> |
false
|
pretty print |
Returns:
- Type
- string
(static) fromString(str) → {BigFraction}
- Description:
Parses a string to create a fraction. Supports integers "123", fractions "1/2", and decimals "1.5".
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string |
Returns:
- Type
- BigFraction