Solidity REPL
Math & units

Signed division

See how negative integer division and remainders round in Solidity.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern to confirm Solidity arithmetic and unit behavior before putting the same expression into a contract. The entry isolates signed division so its input, result, and state changes stay easy to compare.

Solidity to run

int256 value = -10
int256 divisor = 3

value / divisor
value % divisor

What to expect

The transcript shows division rounding toward zero and a remainder with the same sign as the negative dividend.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about writing Solidity Prototype Solidity behavior