Skip to content

editor / formatSvgNumber

Function: formatSvgNumber() ​

formatSvgNumber(value): string

Defined in: io/format-svg-number.ts:15

Number written in SVG path data: rounded to SVG_DECIMALS decimals, shortest form.

Trailing zeros are dropped and a negative zero is written 0. Rounding is that of Number.prototype.toFixed: to the nearest, an exact binary tie away from zero (0.015625 → 0.01563); a transcription must reproduce it rather than round half to even (ADR-0025).

Parameters ​

value ​

number

finite derived coordinate or length, in user units

Returns ​

string

its decimal text, e.g. 86.60254, 2.5, 0

Kind ​

format

See ​

REF-SVG2-PATHS