BigFloat

BigFloat

new BigFloat()

Description:
  • A class for arbitrary-precision floating-point arithmetic.

Source:

Classes

BigFloat

Members

h :number

Description:
  • The handle to the underlying C object.

Source:

The handle to the underlying C object.

Type:
  • number

Methods

abs() → {BigFloat}

Source:
Returns:
Type
BigFloat

acos(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

add(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

and(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

asin(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

atan(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

atan2(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

calc(method, a, b, prec, flagsopt, rnd_modeopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
method string
a BigFloat | number | string | bigint | null null
b BigFloat | number | string | bigint | null null
prec number
flags number <optional>

if set, or with globalflag

rnd_mode number <optional>

if set, overwrite round mode in globalflag

Returns:

this

Type
BigFloat

calc2(method, a, b, prec, rnd_modeopt, q) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
method string
a BigFloat | number | string | bigint | null null
b BigFloat | number | string | bigint | null null
prec number
rnd_mode number <optional>
0
q BigFloat | null null
Returns:

this

Type
BigFloat

callFunc(ofunc, numps, …args) → {BigFloat}

Source:
Parameters:
Name Type Attributes Description
ofunc function
numps number
args any <repeatable>
Returns:
Type
BigFloat

ceil() → {BigFloat}

Source:
Returns:
Type
BigFloat

checkoprand(…args)

Description:
  • Checks if the given arguments are valid operands.

Source:
Parameters:
Name Type Attributes Description
args any <repeatable>

The arguments to check.

checkstatus(s) → {number}

Description:
  • Checks the status of the last operation.

Source:
Parameters:
Name Type Description
s number

The status to check.

Returns:

The status.

Type
number

clone() → {BigFloat}

Description:
  • Clones this BigFloat.

Source:
Returns:
Type
BigFloat

cmp(b) → {number}

Description:
  • Compares this BigFloat with another one.

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:

0 if equal, >0 if this > b, <0 if this < b.

Type
number

copy(a) → {void}

Description:
  • Copies the value of another BigFloat to this one.

Source:
Parameters:
Name Type Description
a BigFloat

The BigFloat to copy from.

Returns:
Type
void

cos(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

cosh(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

dispose(recoverableopt)

Description:
  • Disposes of the BigFloat's resources.

Source:
Parameters:
Name Type Attributes Default Description
recoverable boolean <optional>
true

Whether the BigFloat can be recovered later.

div(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

equals(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

exp(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

f64() → {number}

Description:
  • Converts this BigFloat to a 64-bit float.

Source:
Returns:
Type
number

floor() → {BigFloat}

Source:
Returns:
Type
BigFloat

fpround(prec, rnd_mode) → {BigFloat}

Source:
Parameters:
Name Type Description
prec number
rnd_mode number
Returns:
Type
BigFloat

fromNumber(a) → {void}

Description:
  • Sets the value of this BigFloat from a number.

Source:
Parameters:
Name Type Description
a number
Returns:
Type
void

geth() → {number}

Description:
  • Gets the handle to the underlying C object, creating it if necessary.

Source:
Returns:
Type
number

isAlmostZero() → {boolean}

Description:
  • Checks if this BigFloat is almost zero.

Source:
Returns:
Type
boolean

isExactZero() → {boolean}

Description:
  • Checks if this BigFloat is exactly zero.

Source:
Returns:
Type
boolean

isFinit() → {boolean}

Description:
  • Checks if this BigFloat is finite.

Source:
Returns:
Type
boolean

isInExact() → {boolean}

Description:
  • Checks if the last operation resulted in an inexact result.

Source:
Returns:
Type
boolean

isNaN() → {boolean}

Description:
  • Checks if this BigFloat is NaN.

Source:
Returns:
Type
boolean

isZero() → {boolean}

Description:
  • Checks if this BigFloat is zero.

Source:
Returns:
Type
boolean

log(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

mod(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

mul(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

neg() → {BigFloat}

Source:
Returns:
Type
BigFloat

operatorEqual(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

operatorGreater(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

operatorGreaterEqual(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

operatorLess(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

operatorLessEqual(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

operatorNotEqual(b) → {boolean}

Source:
Parameters:
Name Type Description
b BigFloat | number | string | bigint
Returns:
Type
boolean

or(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

pow(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

rem(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

round() → {BigFloat}

Source:
Returns:
Type
BigFloat

setEPSILON(precopt) → {BigFloat}

Description:
  • Sets this BigFloat to its epsilon value.

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:

this

Type
BigFloat

setLOG2(precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the value of log2(e).

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:

this

Type
BigFloat

setMAX_VALUE(precopt) → {BigFloat}

Description:
  • Sets this BigFloat to its maximum value.

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:

this

Type
BigFloat

setMIN_VALUE(precopt) → {BigFloat}

Description:
  • Sets this BigFloat to its minimum value.

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:

this

Type
BigFloat

setPI(precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the value of PI.

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:

this

Type
BigFloat

setabs() → {BigFloat}

Description:
  • Sets this BigFloat to its absolute value.

Source:
Returns:

this

Type
BigFloat

setacos(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to acos(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setadd(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the sum of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setand(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the bitwise AND of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setasin(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to asin(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setatan(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to atan(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setatan2(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to atan2(a, b).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setceil() → {BigFloat}

Description:
  • Ceils this BigFloat to an integer.

Source:
Returns:

this

Type
BigFloat

setcos(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to cos(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setdiv(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the division of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setexp(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to e^a.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setfloor() → {BigFloat}

Description:
  • Floors this BigFloat to an integer.

Source:
Returns:

this

Type
BigFloat

setfpround(precopt, rnd_modeopt) → {BigFloat}

Description:
  • Rounds this BigFloat to a given precision.

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
rnd_mode number <optional>
Flags.BF_RNDN
Returns:

this

Type
BigFloat

setlog(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to log(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setmod(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the modulus of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setmul(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the product of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setneg() → {BigFloat}

Description:
  • Negates this BigFloat.

Source:
Returns:

this

Type
BigFloat

setor(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the bitwise OR of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setpow(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to a^b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setrem(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the remainder of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setround() → {BigFloat}

Description:
  • Rounds this BigFloat to the nearest integer.

Source:
Returns:

this

Type
BigFloat

setsign(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the sign of a.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setsin(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to sin(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setsqrt(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the square root of a.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

setsub(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the difference of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

settan(a, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to tan(a).

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

settrunc() → {BigFloat}

Description:
  • Truncates this BigFloat to an integer.

Source:
Returns:

this

Type
BigFloat

setxor(a, b, precopt) → {BigFloat}

Description:
  • Sets this BigFloat to the bitwise XOR of a and b.

Source:
Parameters:
Name Type Attributes Default Description
a BigFloat | number | string | bigint
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:

this

Type
BigFloat

sign(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

sin(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

sinh(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

sqrt(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

sub(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

tan(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

tanh(precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
prec number <optional>
0
Returns:
Type
BigFloat

toBigInt() → {bigint}

Source:
Returns:
Type
bigint

toComplex() → {complex}

Description:
  • Converts the BigFloat to a Complex number.

Source:
Returns:
Type
complex

toFixed(radixopt, precopt, rnd_modeopt) → {string}

Source:
Parameters:
Name Type Attributes Default Description
radix number <optional>
10
prec number <optional>
-1

precision digits in radix

rnd_mode number <optional>
Flags.BF_RNDNA
Returns:
Type
string

toNumber() → {number}

Description:
  • Converts this BigFloat to a number.

Source:
Returns:
Type
number

toString(radixopt, precopt, prettyopt) → {string}

Description:
  • toString

Source:
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

toUint8Array() → {Uint8Array}

Description:
  • Converts the BigFloat to a Uint8Array.

Source:
Returns:
Type
Uint8Array

trunc() → {BigFloat}

Source:
Returns:
Type
BigFloat

visit(addToArrayopt)

Description:
  • Marks the BigFloat as visited by the garbage collector.

Source:
Parameters:
Name Type Attributes Default Description
addToArray boolean <optional>
true

Whether to add the BigFloat to the garbage collector's array.

wraptypeh(…ar)

Description:
  • Wraps the given arguments in BigFloat handles.

Source:
Parameters:
Name Type Attributes Description
ar BigFloat | string | number | bigint | object <repeatable>

The arguments to wrap.

Returns:

xor(b, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
b BigFloat | number | string | bigint
prec number <optional>
0
Returns:
Type
BigFloat

(static) fromString(str, radixopt, precopt) → {BigFloat}

Source:
Parameters:
Name Type Attributes Default Description
str string
radix number <optional>
10
prec number <optional>
0
Returns:
Type
BigFloat