@maruaudio/dsp/math/precision marks a number as deliberately double precision. F64 is a type-only brand on number, and asF64(value) returns its argument unchanged with that brand. Nothing is rounded, validated, clamped or coerced to an integer, and no wrapper object exists at runtime. Supported lowerers read the brand as the ordinary f64 representation.
import { asF64, type F64 } from "@maruaudio/dsp/math/precision"
let accumulator: F64 = asF64(0)
accumulator = asF64(accumulator + 0.1)Functions
| Name | Input | Output | Domain |
|---|---|---|---|
F64 | type | number & { __maruNumericIntent: "f64" } | Type only; no runtime value |
asF64 | value: number | the same number, typed F64 | Every JS number, including NaN, ±Infinity and −0 |
Lifecycle
None. The DSP node has no state and no preparation; the manifest calls it a type-only marker and a pure scalar identity.
When to use it
Mark an accumulator, coefficient or phase whose precision must stay f64 when a narrowing build profile would otherwise be free to choose a narrower storage. The processor contract explains when that matters and when ordinary number is enough.
Limits
- A brand cannot authorize narrowing or unchecked access, and it performs no runtime check; an
as F64cast is equally unchecked. - It does not make other expressions f64 or f32.
Float32Arraystorage and existingMath.froundpoints keep their own meaning.