qazbnm456/sc-sentry/arithmetic-rounding
- community
Checking that the SKILL.md file is still in the repository.
Precision lost or a rounding direction that favours the wrong party. The one shape that dominates, and why most of these need a specification to call.
Install
npx vskill@latest install qazbnm456/sc-sentry/arithmetic-roundingSKILL.md
Arithmetic and rounding
An instance is arithmetic whose result is wrong in a direction that matters, at a location a fix would change. Two families, and they are found differently.
Family one: precision destroyed by order of operations
The dominant shape, and the one you can establish from the source alone:
amount / total scale // divides first: the quotient truncates amount scale / total // correct: scales first
Integer division truncates toward zero, so dividing before multiplying throws away every digit below the divisor. Look for a division whose result is then multiplied, or fed into another division. divides_then_scales finds it.
Related, same family:
(a / b) * breconstructed and compared toa- a share price computed as
totalAssets / totalSupplyand then multiplied by
a user's shares, rather than shares * totalAssets / totalSupply
- a fee taken as
amount * feeBps / 10000whereamount * feeBpscan round to
zero for small amounts — a fee-free path for dust
- mixing token decimals without normalising: 6-decimal USDC against 18-decimal
WETH, scaled by a constant that is right for one of them
Family two: the rounding direction favours the wrong party
x / y rounds down. Whether that is a defect depends on who benefits:
- rounding down when computing what a user owes the protocol → the user
underpays
- rounding up when computing what the protocol owes a user → the protocol
overpays
- a deposit that mints
assets * supply / totalAssetsshares rounding down, and
a withdrawal that burns the same formula rounding down — the difference is a slow drain
This family usually needs the protocol's own intent to call. "Rounds down" is not a defect; "rounds down where the accounting identity requires up" is. If the source does not state which way it must go, say so rather than guessing — an unverifiable claim costs precision and measures nothing.
Not an instance
- a division by a literal power of ten used only for display or an event
uncheckedarithmetic where the bound is established immediately above- Solidity ≥ 0.8 overflow: the compiler reverts, so an unchecked overflow is
not this class unless the block is explicitly unchecked
- a truncation of one wei where nothing accumulates it
What to cite
The expression, not the whole statement, when the statement holds several. The smallest complete expression whose rewrite fixes it.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/sc_sentry/skills/arithmetic-rounding/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/qazbnm456/sc-sentry/arithmetic-rounding)