Skip to content

fix: round Firo balance to prevent floating-point errors#3261

Merged
bernd2022 merged 1 commit intodevelopfrom
fix/firo-balance-rounding
Feb 25, 2026
Merged

fix: round Firo balance to prevent floating-point errors#3261
bernd2022 merged 1 commit intodevelopfrom
fix/firo-balance-rounding

Conversation

@bernd2022
Copy link
Collaborator

Summary

  • Fix floating-point precision error in FiroClient.getBalance() where summing UTXO amounts via reduce() produces values like 64.07538018000001 instead of 64.07538018
  • Apply roundAmount() (8 decimal places) to the result, consistent with all other amount calculations in the client

Test plan

  • Verify Firo balance displays correctly without trailing precision artifacts
  • Confirm no regression in Firo payout/payin flows

Summing UTXO amounts with reduce() can accumulate IEEE 754 rounding
errors (e.g. 64.07538018000001 instead of 64.07538018). Apply
roundAmount() to the result, consistent with all other amount
calculations in the client.
@bernd2022 bernd2022 merged commit 03833d3 into develop Feb 25, 2026
8 checks passed
@bernd2022 bernd2022 deleted the fix/firo-balance-rounding branch February 25, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants