Skip to content

fix: remove float error before flooring balance - #2260

Open
prakashNalla wants to merge 1 commit into
interledger:mainfrom
prakashNalla:fix/balance-cent-2259
Open

prakashNalla wants to merge 1 commit into
interledger:mainfrom
prakashNalla:fix/balance-cent-2259

Conversation

@prakashNalla

Copy link
Copy Markdown
Contributor

Context

Changes

  • Strip the float error with toPrecision(15) before flooring in transformBalance. 19.99 * 100 is 1998.9999999999998 in JS, so the floor gave 1998 and the balance was one cent low.
  • Add tests for 19.99, 1.13 and 0.29, and one that a value below the asset scale is still floored (19.999 -> 1999).

Before / after, sending the full 19.99 balance:

before after

@github-actions github-actions Bot added package: wallet/backend Wallet backend implementations type: test Improvements or additions to tests type: source Source changes labels Oct 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: wallet/backend Wallet backend implementations type: source Source changes type: test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Account balance is one cent low for amounts like 19.99

1 participant