-
Notifications
You must be signed in to change notification settings - Fork 10
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: fix floating point issue in convertToMinorUnit [ROW-512] #194
Conversation
🦋 Changeset detectedLatest commit: bdbf9dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This comment has been minimized.
This comment has been minimized.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #194 +/- ##
=======================================
Coverage 96.59% 96.59%
=======================================
Files 51 51
Lines 704 704
Branches 172 173 +1
=======================================
Hits 680 680
Misses 24 24 ☔ View full report in Codecov by Sentry. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Bundle Size Report
|
🟢 No Change | 🗑 File Deleted | 🆕 New File | 📈 Size Increased | 👍 Size Reduced |
---|
Parsed (kb) | |||||
---|---|---|---|---|---|
🚦 | File Name | Base | PR | Diff | % |
📈 | cjs/index.js |
158.28 |
158.3 |
|
0.01 |
📈 | esm/index.min.js |
60.27 |
60.3 |
|
0.05 |
📈 | umd/index.js |
179.56 |
179.58 |
|
0.01 |
This comment has been minimized.
This comment has been minimized.
Unit Test Results0 files 0 suites 0s ⏱️ Results for commit 5bbace7. |
Description
https://razorpay.slack.com/archives/C05JJL46C93/p1734083710224829?thread_ts=1733977437.431299&cid=C05JJL46C93
Root Cause:
The issue arises from JavaScript’s floating-point arithmetic using IEEE 754, which cannot accurately represent some decimal values. This causes precision errors, such as 4.14 * 100 resulting in 413.99999999999994 instead of 414.
Changes Made
List the main changes made in this pull request.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Additional Notes
Any additional information that would be helpful for the reviewer.
Checklist:
Reviewer Checklist
PR Title Format
Format:
<type>: <subject>
Types can be as follows:
feat
: (new feature for the user, not a new feature for build script)fix
: (bug fix for the user, not a fix to a build script)docs
: (changes to the documentation)style
: (formatting, missing semi colons, etc; no production code change)refactor
: (refactoring production code, eg. renaming a variable)test
: (adding missing tests, refactoring tests; no production code change)chore
: (updating grunt tasks etc; no production code change)