Constructor
new Scalar(v)
Properties:
| Name | Type | Description |
|---|---|---|
value |
BigFraction | BigFloat | Complex | The underlying numeric value. |
level |
number | The type promotion level (0, 1, or 2). |
Parameters:
| Name | Type | Description |
|---|---|---|
v |
number | bigint | string | BigFraction | BigFloat | Complex | Scalar |
Classes
Methods
abs() → {Scalar}
Returns:
- Type
- Scalar
acos() → {Scalar}
Returns:
- Type
- Scalar
acosh() → {Scalar}
Returns:
- Type
- Scalar
add(other)
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any | @returns {Scalar} |
asin() → {Scalar}
Returns:
- Type
- Scalar
asinh() → {Scalar}
Returns:
- Type
- Scalar
atan() → {Scalar}
Returns:
- Type
- Scalar
atanh() → {Scalar}
Returns:
- Type
- Scalar
cmp(other) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any |
Returns:
-1 if this < other, 0 if this === other, 1 if this > other.
- Type
- number
cos() → {Scalar}
Returns:
- Type
- Scalar
cosh() → {Scalar}
Returns:
- Type
- Scalar
div(other)
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any | @returns {Scalar} |
equals(other) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any |
Returns:
- Type
- boolean
exp() → {Scalar}
Returns:
- Type
- Scalar
isAlmostZero() → {boolean}
Returns:
- Type
- boolean
isZero() → {boolean}
Returns:
- Type
- boolean
log() → {Scalar}
Returns:
- Type
- Scalar
mul(other)
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any | @returns {Scalar} |
neg() → {Scalar}
Returns:
- Type
- Scalar
operatorAdd(b)
Parameters:
| Name | Type | Description |
|---|---|---|
b |
Scalar | any | @returns {Scalar} |
operatorDiv(b)
Parameters:
| Name | Type | Description |
|---|---|---|
b |
Scalar | any | @returns {Scalar} |
operatorMul(b)
Parameters:
| Name | Type | Description |
|---|---|---|
b |
Scalar | any | @returns {Scalar} |
operatorNeg() → {Scalar}
Returns:
- Type
- Scalar
operatorPow(b)
Parameters:
| Name | Type | Description |
|---|---|---|
b |
Scalar | any | @returns {Scalar} |
operatorSub(b)
Parameters:
| Name | Type | Description |
|---|---|---|
b |
Scalar | any | @returns {Scalar} |
pow(other)
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any | @returns {Scalar} |
sin() → {Scalar}
Returns:
- Type
- Scalar
sinh() → {Scalar}
Returns:
- Type
- Scalar
sqrt() → {Scalar}
Returns:
- Type
- Scalar
sub(other)
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Scalar | any | @returns {Scalar} |
tan() → {Scalar}
Returns:
- Type
- Scalar
tanh() → {Scalar}
Returns:
- Type
- Scalar
toString(radixopt, precisionopt, prettyopt) → {string}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
radix |
number |
<optional> |
10
|
|
precision |
number |
<optional> |
-1
|
|
pretty |
boolean |
<optional> |
false
|
pretty print |
Returns:
- Type
- string
(static) fromString(str) → {Scalar}
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string |
Returns:
- Type
- Scalar
(static) getLevel(v) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
v |
any | The value to check. |
Returns:
The promotion level.
- Type
- number
(static) promote(v, targetLevel) → {any}
Parameters:
| Name | Type | Description |
|---|---|---|
v |
any | The value to promote. |
targetLevel |
number | The target promotion level. |
Returns:
The promoted value.
- Type
- any