-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(number): don't ignore multipleOf in float when min=max #3417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(number): don't ignore multipleOf in float when min=max #3417
Conversation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3417 +/- ##
=======================================
Coverage 99.97% 99.97%
=======================================
Files 2836 2836
Lines 218603 218600 -3
Branches 953 951 -2
=======================================
- Hits 218548 218545 -3
Misses 55 55
🚀 New features to boost your workflow:
|
Co-authored-by: ST-DDT <ST-DDT@gmx.de>
I'm unsure how to continue here. By semantic versioning definition this change should be considered breaking. On the other side this feature is implemented for at least one year and the issue with this misaligned behaviour was never raised. |
It's a bugfix and I think the old behavior is unexpected and undocumented so I think patch-level is ok. |
Thanks for giving your thought on that. The problem is that semantic versioning doesn't care about a behavior being unexpected. But I partially agree, so I'll approve as well. |
Currently,
faker.number.float({ min: 6, max: 6, multipleOf: 5 })
does not throw, even though 6 is not a multiple of 5.This PR removes the shortcut when
min === max
bypassing the multipleOf checks.Now, it throws an error similar to
int()
(and soonbigInt()
).This issue was discovered while reviewing #3402