Skip to content
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: correct bn formatting bug with 0 units #3300

Merged
merged 12 commits into from
Oct 10, 2024
Merged

Conversation

maschad
Copy link
Member

@maschad maschad commented Oct 9, 2024

Release notes

In this release, we:

  • fixed an issue where formatting with 0 in the bn class returned an incorrect value

Summary

Fixed a formatting issue in the bn library which caused big numbers formatted with unit, minPrecision and/or precision set to 0 to be incorrectly formatted.

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 3:43pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 3:43pm

Copy link

codspeed-hq bot commented Oct 9, 2024

CodSpeed Performance Report

Merging #3300 will not alter performance

Comparing mc/fix/bn-precision-fix (ae2f55a) with master (9c70eba)

Summary

✅ 18 untouched benchmarks

@danielbate danielbate enabled auto-merge (squash) October 10, 2024 15:34
Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
76.12%(-0.12%) 70.19%(-0.11%) 75.13%(-0.05%) 76.25%(-0.11%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/math/src/bn.ts 88.23%
(-0.14%)
87.5%
(+1.79%)
80%
(+0%)
88.23%
(-0.14%)
🔴 packages/math/src/decimal.ts 0%
(-100%)
0%
(-50%)
0%
(-100%)
0%
(-100%)

@danielbate danielbate merged commit b733e81 into master Oct 10, 2024
24 checks passed
@danielbate danielbate deleted the mc/fix/bn-precision-fix branch October 10, 2024 15:56
@Dhaiwat10 Dhaiwat10 mentioned this pull request Oct 13, 2024
4 tasks
Dhaiwat10 pushed a commit that referenced this pull request Nov 19, 2024
* wip

* fix: return correcly formatted bn units

* docs: add changeset

* linting fixes

* fix: ensure signficant figures are returned even if they exceed the precision

* fix: adhere to precision if the whole number is greater than zero

* chore: update test doc

---------

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>
Co-authored-by: Daniel Bate <djbate23@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bn library bugs when you're using units / precision zero
6 participants