Version: dev

format_canonical_float

Stable function · Document I/O

Tier: stable · Kind: function · Topic: Document I/O

JuliaTypeScriptPythonRustGo
format_canonical_floatformatCanonicalFloatnot exportedformat_canonical_floatnot exported

Julia

format_canonical_float(f::Float64)
format_canonical_float(f::Float64) -> String

Format a finite Float64 per RFC §5.4.6.

Source

TypeScript

function formatCanonicalFloat(f: number): string

Format a finite number as a byte-CANONICAL float token per RFC §5.4.6. Only handles float-typed values: integer-typed NumericLiteral nodes are emitted as bare JSON integers by canonicalJson directly.

NAMING: distinct from formatFloatToken in ./numeric-literal (the document-serialization emitter used by toJson() / losslessJsonStringify). This canonical version additionally NORMALIZES exponent notation — it strips the leading + (RFC §5.4.6: “no leading + on the exponent”) so 1e25 emits as 1e25, not 1e+25, and forces the §5.4.6 exponent thresholds. Use this one for canonical output, formatFloatToken for wire round-trip.

Source

Python

Python does not export this function.

Rust

pub fn format_canonical_float(f: f64) -> String

Format a finite f64 per RFC §5.4.6.

Source · Rust docs

Go

Go does not export this function.