liveBook · Manning

Remainder operation

A remainder operation returns the residual left after dividing one value or algebraic expression by another under the applicable division rules.

How 3 Manning books explain it

Math for Web Design

The remainder operator is the JavaScript operator (%) that returns the remainder after division, with behavior that depends on the signs of its operands.

How it is used
Supports cyclical interfaces, carousel navigation, and animations that must wrap values into a repeating range.
How deep it goes
Explains circular modulo intuition, JavaScript’s negative-dividend behavior, and a normalization formula, then stops short of broader arithmetic internals.
Examples
Uses a five-position circle, JavaScript remainder expressions, a reusable mod function, and a carousel back-button calculation.
What you can do after
Diagnose and prevent invalid cyclical indexes by normalizing JavaScript remainders before using them for navigation or animation.

Read how Math for Web Design explains remainder operation →

Get Programming: Learn to code with Python

A Python operator that computes the remainder after division of one numeric operand by another.

How it is used
Uses the remainder operator to calculate leftover minutes in a first Python conversion program.
How deep it goes
Defines remainder with small arithmetic examples and applies it in a complete conversion program.
Examples
Uses 3 % 2, 6 % 4, and 123-minute conversion examples.
What you can do after
Apply it via Python to calculate values left after division and split totals into complete units and remainders.

Read how Get Programming: Learn to code with Python explains remainder operation →

Grokking Data Structures

The modulo operator computes the remainder after integer division.

How it is used
Maps virtual positions back to valid indexes while implementing a circular queue in a static array.
How deep it goes
Defines remainders for positive integers and works through wraparound examples, without developing modular arithmetic beyond array indexing.
Examples
Uses an eight-element array with 8 % 8 == 0, 9 % 8 == 1, and 10 % 8 == 2.
What you can do after
Apply modulo to convert virtual queue positions into valid static-array indexes.

Read how Grokking Data Structures explains remainder operation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.