Repository navigation
Conversation
✅ Deploy Preview for fakerjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #4162 +/- ##
=======================================
Coverage 99.13% 99.14%
=======================================
Files 1177 1177
Lines 3939 3957 +18
Branches 697 717 +20
=======================================
+ Hits 3905 3923 +18
+ Misses 30 29 -1
- Partials 4 5 +1
🚀 New features to boost your workflow:
|
|
Although this handles “nice” literals like 0.3 or 1.5 with matching bounds, it isn’t a full fix, and it can regress other bounds. For example:
For a more general fix I’d:
|
|
I also considered "tricking" the engine to collapse these values by itself. E.g. by using +1-1 or /10*10 But I havent looked any deeper into this yet. |
|
@matthewmayer you're right on both points. Reworked in f31bab0 along the lines you suggested:
@ST-DDT re the "+1-1" / "/10*10" idea: I think that would only round away the representation error after the fact. It wouldn't bring back a bound that |
faker.number.float()with a decimalmultipleOfthat is not a power of ten (0.3, 0.25, 1.5, ...) divides by1 / multipleOf. Floating-point error in that division gives values that are not the intended multiples, and some of them fall belowmin:For a decimal step, this change scales by the step's own number of decimal places instead. It picks an integer multiple of the scaled step, then divides once, so 3 × 0.3 becomes
9 / 10 = 0.9. Steps of the form 10^-n and non-decimal steps keep the existing code path. The new test fails onnextand passes with the fix.AI-assisted: I directed the investigation and reviewed and verified the change myself.