Skip to content

fix(money): reject fractional-cent numbers - #59

Merged
ralyodio merged 1 commit into
moshcoder:masterfrom
qwenbona:fix/money-fractional-cents
Jul 31, 2026
Merged

fix(money): reject fractional-cent numbers#59
ralyodio merged 1 commit into
moshcoder:masterfrom
qwenbona:fix/money-fractional-cents

Conversation

@qwenbona

Copy link
Copy Markdown
Contributor

The numeric path in setupAmountUsd silently rounded values like 1.234 to 1.23. The string path already enforces cent-precision via regex; make the numeric path reject fractional cents too.

Fixes #54

The numeric path in setupAmountUsd silently rounded values like 1.234
to 1.23. The string path already enforces cent-precision via regex;
make the numeric path reject fractional cents too so both inputs follow
the same rule.

Fixes moshcoder#54
@ralyodio
ralyodio merged commit 0d100a2 into moshcoder:master Jul 31, 2026
2 checks passed
ralyodio added a commit that referenced this pull request Jul 31, 2026
PR #59 made the numeric path of setupAmountUsd reject values finer than
a cent, but left the assertion that 2.345 rounds to 2.35 — the exact
behavior it removed. That assertion has failed on master ever since, so
every PR opened since #59 shows a red test check.

Assert the numeric path on a value it actually accepts, and add the
regression coverage issue #54 asked for (1.234 and 0.004) that #59
described but never landed.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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