You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rule would disallow the use of number literals that immediately lose precision at runtime when converted to a JS Number due to 64-bit floating-point rounding.
Rule Details
In JS, Numbers are stored as double-precision floating-point numbers according to the IEEE 754 standard. Because of this, numbers can only retain accuracy up to a certain amount of digits. If the programmer enters additional digits, those digits will be lost in the conversion to the Number type and will result in unexpected behavior.
https://eslint.org/docs/rules/no-loss-of-precision
This rule would disallow the use of number literals that immediately lose precision at runtime when converted to a JS
Number
due to 64-bit floating-point rounding.Rule Details
In JS,
Number
s are stored as double-precision floating-point numbers according to the IEEE 754 standard. Because of this, numbers can only retain accuracy up to a certain amount of digits. If the programmer enters additional digits, those digits will be lost in the conversion to theNumber
type and will result in unexpected behavior.Examples of incorrect code for this rule:
Examples of correct code for this rule:
The text was updated successfully, but these errors were encountered: