Skip to content

BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:43

IEEE 754 binary64 (double-precision) floating-point number.

Backed directly by the native JS number type — all arithmetic is performed by the JavaScript engine with hardware double-precision semantics.

Role in the type hierarchy:

  • BinaryFp16 and BinaryFp32 are backed by a number too, rounding to their narrower precision after each operation.
  • For software-emulated wide formats (binary128+), use BinaryFp.

References:

  • BinaryFpBase<BinaryFp64>

new BinaryFp64(value): BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:75

number

BinaryFp64

BinaryFpBase<BinaryFp64>.constructor

readonly static IEEE754: IeeeFormat = IEEE_FORMAT_BINARY64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:58

IEEE 754-2008 structural parameters for binary64. b=2, k=64, p=53, emax=1023.


readonly static INFINITY: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:71

IEEE 754 positive infinity.


readonly static NAN: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:69

IEEE 754 Not-a-Number.


readonly static NEG_INFINITY: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:73

IEEE 754 negative infinity.


readonly static ONE: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:63

Multiplicative identity 1.0.


readonly static STRUCTURE: AlgebraicStructure = APPROXIMATE_ORDERED_FIELD

Defined in: packages/math-numbers/src/num/_binary-fp-base.ts:41

Binary floating point is not a field: every operation rounds, so associativity and distributivity fail.

BinaryFpBase.STRUCTURE


readonly static TAG: typeof TAG

Defined in: packages/math-numbers/src/num/binary-fp64.ts:52

Unique type tag used by the converter registry.


readonly static TEN: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:67

The value 10.0.


readonly static TWO: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:65

The value 2.0.


readonly static ZERO: BinaryFp64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:61

Additive identity 0.0.

get bitWidth(): 64

Defined in: packages/math-numbers/src/num/binary-fp64.ts:47

Total width of the representation, in bits.

64

Total width of the representation, in bits.

IFixedPrecision.bitWidth

BinaryFpBase.bitWidth


get decimalPrecision(): number

Defined in: packages/math-numbers/src/num/binary-fp64.ts:152

Number of significant decimal digits in this value’s string representation. Returns DBL_DIG (15) for NaN/±∞.

number

Total number of significant decimal digits needed to exactly represent this value.

Returns Number.POSITIVE_INFINITY for values with non-terminating decimal expansions (e.g. Fraction(1, 3), √2).

Integer.from(12345n).decimalPrecision; // → 5
Decimal.from("3.14").decimalPrecision; // → 3
Fraction.from(1n, 3n).decimalPrecision; // → Infinity
```;
#### Implementation of
[`INum`](../interfaces/INum.md).[`decimalPrecision`](../interfaces/INum.md#decimalprecision)
#### Overrides
`BinaryFpBase.decimalPrecision`
***
### formatInfo
#### Get Signature
> **get** **formatInfo**(): [`FixedPrecisionInfo`](../type-aliases/FixedPrecisionInfo.md)\<`BinaryFp64`\>
Defined in: packages/math-numbers/src/num/binary-fp64.ts:287
Fixed-precision format descriptor for IEEE 754 binary64.
##### Returns
[`FixedPrecisionInfo`](../type-aliases/FixedPrecisionInfo.md)\<`BinaryFp64`\>
#### Overrides
`BinaryFpBase.formatInfo`
***
### fractionalPrecision
#### Get Signature
> **get** **fractionalPrecision**(): `number`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:174
Number of decimal digits in the fractional part of `|value|`. `0` for
integer-valued doubles.
##### Returns
`number`
Number of decimal digits in the fractional part of `|value|`. `0` for exact
integers. Returns `Number.POSITIVE_INFINITY` for non-terminating decimal
expansions.
#### Example
```ts
Integer.from(42n).fractionalPrecision; // → 0
Decimal.from("3.14").fractionalPrecision; // → 2
Fraction.from(1n, 3n).fractionalPrecision; // → Infinity
```;
#### Implementation of
[`INum`](../interfaces/INum.md).[`fractionalPrecision`](../interfaces/INum.md#fractionalprecision)
#### Overrides
`BinaryFpBase.fractionalPrecision`
***
### integralPrecision
#### Get Signature
> **get** **integralPrecision**(): `number`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:162
Number of decimal digits in the integer part of `|value|`. Always at least
`1`.
##### Returns
`number`
Number of decimal digits in the integer (integral) part of `|value|`.
Always at least `1` (the digit `0` for values with `|value| < 1`).
#### Example
```ts
Integer.from(123n).integralPrecision; // → 3
Decimal.from("0.5").integralPrecision; // → 1 (the leading '0')
Decimal.from("3.14").integralPrecision; // → 1
```;
#### Implementation of
[`INum`](../interfaces/INum.md).[`integralPrecision`](../interfaces/INum.md#integralprecision)
#### Overrides
`BinaryFpBase.integralPrecision`
***
### isFinite
#### Get Signature
> **get** **isFinite**(): `boolean`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:94
`true` if this value is finite (not NaN and not ±∞).
##### Returns
`boolean`
***
### isInfinite
#### Get Signature
> **get** **isInfinite**(): `boolean`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:99
`true` if this value is +∞ or −∞.
##### Returns
`boolean`
***
### isNaN
#### Get Signature
> **get** **isNaN**(): `boolean`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:89
`true` if this value is IEEE 754 NaN.
##### Returns
`boolean`
***
### precisionKind
#### Get Signature
> **get** **precisionKind**(): `"fixed"`
Defined in: packages/math-numbers/src/num/\_binary-fp-base.ts:30
##### Returns
`"fixed"`
#### Implementation of
[`IFixedPrecision`](../interfaces/IFixedPrecision.md).[`precisionKind`](../interfaces/IFixedPrecision.md#precisionkind)
#### Inherited from
`BinaryFpBase.precisionKind`
***
### radix
#### Get Signature
> **get** **radix**(): `2`
Defined in: packages/math-numbers/src/num/\_binary-fp-base.ts:33
##### Returns
`2`
#### Implementation of
[`IBinaryEncoded`](../interfaces/IBinaryEncoded.md).[`radix`](../interfaces/IBinaryEncoded.md#radix)
#### Inherited from
`BinaryFpBase.radix`
## Methods
### \[toPrimitive\]()
> **\[toPrimitive\]**(`hint`): `string` \| `number` \| `bigint`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:137
Coerces to a JS primitive.
#### Parameters
##### hint
`"string"` \| `"number"` \| `"default"`
#### Returns
`string` \| `number` \| `bigint`
#### Implementation of
[`INum`](../interfaces/INum.md).[`[toPrimitive]`](../interfaces/INum.md#toprimitive)
#### Overrides
`BinaryFpBase.[toPrimitive]`
***
### abs()
> **abs**(): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:257
Absolute value `|x|`.
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.abs`
***
### add()
> **add**(`other`): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:201
Returns `this + other`.
#### Parameters
##### other
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.add`
***
### bitAt()
> **bitAt**(`position`): `0` \| `1`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:310
Returns the bit at `position` in the IEEE 754 binary64 layout of this
value. Position `0` is the least-significant bit; position `63` is the sign
bit.
Reference: https://en.wikipedia.org/wiki/IEEE_754#Formats
#### Parameters
##### position
`number`
#### Returns
`0` \| `1`
#### Throws
When `position` is outside `[0, 63]`.
#### Overrides
`BinaryFpBase.bitAt`
***
### clamp()
> **clamp**(`lower`, `upper`): `BinaryFp64`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:69
Restricts the value to `[lower, upper]`.
#### Parameters
##### lower
`BinaryFp64`
##### upper
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Inherited from
`BinaryFpBase.clamp`
***
### cmp()
> **cmp**(`other`): `Sign`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:244
Three-way comparison.
#### Parameters
##### other
`BinaryFp64`
#### Returns
`Sign`
#### Throws
When either value is NaN (NaN is unordered in IEEE
754).
#### Overrides
`BinaryFpBase.cmp`
***
### div()
> **div**(`other`): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:230
Returns `this / other` (IEEE 754 semantics).
#### Parameters
##### other
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.div`
***
### eq()
> **eq**(`other`): `boolean`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:45
#### Parameters
##### other
`BinaryFp64`
#### Returns
`boolean`
#### Inherited from
`BinaryFpBase.eq`
***
### format()
> **format**(`locales?`, `options?`): `string`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:124
This value rendered for a human, by `Intl.NumberFormat`.
The parameters are `new Intl.NumberFormat(locales, options)`'s own,
unchanged — including the default, which is the ambient locale. Ask for
`"en-US"` with `useGrouping: false` when the output has to be
machine-readable.
#### Parameters
##### locales?
`LocalesArgument`
##### options?
`NumberFormatOptions`
#### Returns
`string`
#### Implementation of
[`INum`](../interfaces/INum.md).[`format`](../interfaces/INum.md#format)
#### Overrides
`BinaryFpBase.format`
***
### gt()
> **gt**(`other`): `boolean`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:57
#### Parameters
##### other
`BinaryFp64`
#### Returns
`boolean`
#### Inherited from
`BinaryFpBase.gt`
***
### gte()
> **gte**(`other`): `boolean`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:73
#### Parameters
##### other
`BinaryFp64`
#### Returns
`boolean`
#### Inherited from
`BinaryFpBase.gte`
***
### identity()
> **identity**(): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:192
Returns the multiplicative identity `1.0`.
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.identity`
***
### inv()
> **inv**(): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:225
Returns `1 / this`. Returns ±∞ when `this` is zero (IEEE 754 semantics).
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.inv`
***
### lt()
> **lt**(`other`): `boolean`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:49
#### Parameters
##### other
`BinaryFp64`
#### Returns
`boolean`
#### Inherited from
`BinaryFpBase.lt`
***
### lte()
> **lte**(`other`): `boolean`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:53
#### Parameters
##### other
`BinaryFp64`
#### Returns
`boolean`
#### Inherited from
`BinaryFpBase.lte`
***
### max()
> **max**(`other`): `BinaryFp64`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:65
The larger of the two operands under the total order.
#### Parameters
##### other
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Inherited from
`BinaryFpBase.max`
***
### min()
> **min**(`other`): `BinaryFp64`
Defined in: packages/math-algebra/src/\_ordered-defaults.ts:61
The smaller of the two operands under the total order.
#### Parameters
##### other
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Inherited from
`BinaryFpBase.min`
***
### mul()
> **mul**(`other`): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:187
Returns `this × other`.
#### Parameters
##### other
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.mul`
***
### neg()
> **neg**(): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:211
Returns `−this`.
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.neg`
***
### sign()
> **sign**(): `Sign`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:266
Sign of this value.
#### Returns
`Sign`
`-1` for negative, `0` for zero/NaN, `+1` for positive.
#### Overrides
`BinaryFpBase.sign`
***
### sqrt()
> **sqrt**(): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:278
Principal square root `√x`. Returns `NaN` for negative inputs (IEEE 754
semantics).
Reference: https://en.wikipedia.org/wiki/Square_root
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.sqrt`
***
### sub()
> **sub**(`other`): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:216
Returns `this − other`.
#### Parameters
##### other
`BinaryFp64`
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.sub`
***
### toExponential()
> **toExponential**(`fractionDigits?`): `string`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:116
Exponential notation: one digit before the point, `fractionDigits` after,
and an `e±` exponent. Omitting the count shows as many as the value has,
matching `Number.prototype.toExponential`.
#### Parameters
##### fractionDigits?
`number`
#### Returns
`string`
#### Implementation of
[`INum`](../interfaces/INum.md).[`toExponential`](../interfaces/INum.md#toexponential)
#### Overrides
`BinaryFpBase.toExponential`
***
### toFixed()
> **toFixed**(`fractionDigits?`): `string`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:112
Fixed-point notation with exactly `fractionDigits` places, padded with
zeros where the value has fewer — `Number.prototype.toFixed`, without its
cap of 100. A type that can hold more places can show them.
#### Parameters
##### fractionDigits?
`number` = `0`
#### Returns
`string`
#### Implementation of
[`INum`](../interfaces/INum.md).[`toFixed`](../interfaces/INum.md#tofixed)
#### Overrides
`BinaryFpBase.toFixed`
***
### toPrecision()
> **toPrecision**(`precision`): `string`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:120
`precision` significant digits, switching to exponential notation at the
same thresholds `Number.prototype.toPrecision` does.
#### Parameters
##### precision
`number`
#### Returns
`string`
#### Implementation of
[`INum`](../interfaces/INum.md).[`toPrecision`](../interfaces/INum.md#toprecision)
#### Overrides
`BinaryFpBase.toPrecision`
***
### toString()
> **toString**(`radix?`): `string`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:108
The shortest numeral that round-trips, or `radix` when given.
#### Parameters
##### radix?
`number`
#### Returns
`string`
#### Implementation of
[`INum`](../interfaces/INum.md).[`toString`](../interfaces/INum.md#tostring)
#### Overrides
`BinaryFpBase.toString`
***
### valueOf()
> **valueOf**(): `number`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:132
Returns the underlying `number` value.
#### Returns
`number`
#### Implementation of
[`INum`](../interfaces/INum.md).[`valueOf`](../interfaces/INum.md#valueof)
#### Overrides
`BinaryFpBase.valueOf`
***
### zero()
> **zero**(): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:206
Returns the additive identity `0.0`.
#### Returns
`BinaryFp64`
#### Overrides
`BinaryFpBase.zero`
***
### from()
> `static` **from**(`value`): `BinaryFp64`
Defined in: packages/math-numbers/src/num/binary-fp64.ts:80
Creates a `BinaryFp64` from a `number` or parseable numeric string.
#### Parameters
##### value
`string` \| `number`
#### Returns
`BinaryFp64`