Rule idea: no imprecise number literals
See original GitHub issuePlease describe what the rule should do:
Flag number literals which do not precisely represent an IEEE754 double. Have an option to allow number literals that round to Infinity
, such as 2e308
, a somewhat common pattern to avoid referring to the Infinity
global.
What category of rule is this? (place an “X” next to just one item)
- Enforces code style
- Warns about a potential error
- Suggests an alternate way of doing something
- Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
0.1234567890123456789
12345678901234567890
12345678.901234567890
0xFFFFFFFFFFFFFFF
Why should this rule be included in ESLint (instead of a plugin)?
It’s a possible error that can affect all JavaScript users and can lead to logic bugs that are very hard to notice.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:16 (14 by maintainers)
Top Results From Across the Web
Extended Logic Programs - Department of Computing
Reducts, answer sets, splitting sets, etc, then work exactly as usual, except that an answer set will be a set of literals not...
Read more >Plain Meaning Rule | Encyclopedia MDPI
The plain meaning rule, also known as the literal rule, is one of three rules of statutory construction traditionally applied by English courts....
Read more >Objective C - Coding Rules
Assignments within sub-expressions are hard to spot and therefore make the code less readable. Ideally, sub-expressions should not have side-effects.
Read more >A Decision Theory for Imprecise Probabilities
Introduction. How confident are you that someone exactly one hundred and forty- three days younger than you owns exactly nine bicycles? Give me...
Read more >Abstract, Concrete, General and Specific Terms
Abstract terms refer to ideas or concepts; they have no physical referents. ... But we must understand how imprecise their meanings are, how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In practice, what’s the advantage of referring to
0.10000000000000000555
rather than0.1
? Does the system become more mathematically sound (e.g. by avoiding unexpected rounding errors)?To me,
0.1
seems more readable than0.10000000000000000555
because the former makes it clear that the literal is supposed to represent the mathematical value of1/10
, to the extent that floating-point precision can allow.The rule should probably display the exact value of the literal, so that it can be substituted for by the programmer.