@mocanvas/editor · function

toFixed

declare function toFixed(n: number, precision?: number): number

Round n to precision decimal places, without the float dust that a naive Math.round(n * 100) / 100 leaves behind.

Every number that reaches the persisted document goes through this: a coordinate written as 0.30000000000000004 is a diff against a peer who wrote 0.3, and a sync layer cannot tell that apart from a real edit.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.