-
-
Notifications
You must be signed in to change notification settings - Fork 925
Labels
A-linterArea - LinterArea - Linter
Description
What version of Oxlint are you using?
1.51.0
What command did you run?
oxlint
What does your .oxlintrc.json (or oxlint.config.ts) config file look like?
No config
What happened?
const x = 3e-308; produces no-loss-of-precision. I think that's not what users would expect ( and it's inconsistent with eslint)
Consider the following demonstration
const x = 3e-308; // oxlint warns, ESLint does not
console.log(x.toPrecision(17)); // "3.0000000000000002e-308", 16 correct decimal digits
const y = 0.1; // neither warns, even though this also has 16 correct digits
console.log(y.toPrecision(17)); // "0.10000000000000001",
Now, using toPrecision(18) reveals that with 0.1, you get 17 precise digits, but with 3e-308 only 16, maybe that's why oxlint reports this. But as far as I can tell, doubles only guarantee 16 precise digits, and the literals specify only 1 digit, and that one is preserved exactly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter
Type
Fields
Give feedbackPriority
None yet
Effort
None yet