Skip to content

ieeeBinaryToString

ieeeBinaryToString(value, format, radix?): string

Defined in: packages/math-numbers/src/ieee754/binary/ieee-binary-to-string.ts:31

The canonical numeral for a binary float, spelled the way the language spells one: "NaN", "Infinity", "-Infinity", and "0" for either zero.

Which numeral a finite value gets depends on whether the engine can hold it:

  • binary16/32/64 are exactly representable as a number, so this is Number.prototype.toString — the shortest numeral that round-trips.
  • binary128 has no engine to ask, so this is the exact expansion instead, which is longer. Same number either way; a shortest-round-trip algorithm for the wide formats is planned.

A non-decimal radix is truncated at an intrinsic digit limit either way, since Number.prototype.toString does the same — (0.1).toString(16) is "0.1999999999999a", not an endless expansion.

IeeeBinary

The value to render.

IeeeFormat

The format value is expressed in.

number

The base, from 2 to 36. Defaults to 10.

string

The numeral.