Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 1.08 KB

no-loss-of-precision.md

File metadata and controls

24 lines (15 loc) · 1.08 KB

no-loss-of-precision

📝 Disallow numeric literals that lose precision when represented as IEEE 754 binary64 values.

🚫 Disabled by default.

Reports numeric literals that lose their written precision when converted to IEEE 754 binary64. This checks round-tripping, not a fixed digit limit. Decimal literals exceeding 100 significant digits are reported because Number#toPrecision() cannot compare them.

Supports JSON, JSONC, JSON5, TOML floats, and parsed CSS numbers, dimensions, and percentages. TOML integers and raw CSS values, including custom properties, are ignored. For JavaScript and TypeScript, use ESLint's core no-loss-of-precision rule.

SOML support checks floats only; its integers are represented exactly as 64-bit integers.

Examples

// ❌
{"value": 1.23456789012345678}

// ✅
{"value": 0.30000000000000004}