-
-
Notifications
You must be signed in to change notification settings - Fork 920
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
feat(number)!: default to high precision float #1675
feat(number)!: default to high precision float #1675
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #1675 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 2340 2340
Lines 234254 234260 +6
Branches 1112 1116 +4
=======================================
+ Hits 233421 233427 +6
Misses 812 812
Partials 21 21
|
# Conflicts: # test/__snapshots__/number.spec.ts.snap
Co-authored-by: Shinigami <[email protected]>
Looks like we broke a test. |
I don't think that test makes much sense (precision 0) Probably throwing an error is better |
Some weird error with codecov on CI |
Mhh, a float with a precision of zero is an int. |
no, a float with precision 1 is an int |
Oh yeah, you are totally right. Do we have a test that ensures the following const actual = faker.number.float({precision: 1, ?});
expect(actual).toSatisfy(Number.isInteger); ? |
i don't think this needs the breaking change label? Because this is only applied to |
You did call it a breaking change yourself. Even if only in a private function. Please be consistent whether you want to support JS or not! If yes, this is a breaking change for JS users since the way mersenne returns values was changed. Edit: Thats exactly why I hate mixing points of interest in PRs! This change could have been done without touching mersenne in any way. |
TBH I understand @xDivisionByZerox points here I also understand that it might sometimes be better to make smaller PRs and split them, but for now I'm fine with the current state (except the english spelling in JSDoc), but then I can approve this 👍 |
Co-authored-by: Shinigami <[email protected]>
There's not really a good definition of breaking change. You have to use your common sense as every change is a breaking change if your workflow is weird enough! Anyway since this IS landing in a major release, whether it is breaking or not is moot. |
fix #1655
Note in order to reduce unexpected changes, i made a new code path for the default case when precision is not passed which grabs a float from Mersenne directly, while keeping the old logic intact (going via an integer) when a precision is pased.
I also added {precision: 0.01} in a few places in the code where float() was previously used to avoid unnecessary changes.