Advertisement

Practical modulo calculator

Apply the same remainder rule to a 24-hour clock, a zero-based list or an integer dividend. Negative offsets wrap backwards.

Calculator

Wrapped result
03:00
Nonnegative residue
3.00000000
Nonpositive equivalent residue
-21
Exact division identity
27 = 24 × (1) + 3
First steps around the cycle
Steps forward from startWrapped value
0.0000000023.00000000
1.000000000.00000000
2.000000001.00000000
3.000000002.00000000
4.000000003.00000000
5.000000004.00000000
6.000000005.00000000
7.000000006.00000000
8.000000007.00000000
9.000000008.00000000
10.000000009.00000000
11.0000000010.00000000
12.0000000011.00000000
13.0000000012.00000000
14.0000000013.00000000
15.0000000014.00000000
16.0000000015.00000000
17.0000000016.00000000
18.0000000017.00000000
19.0000000018.00000000
20.0000000019.00000000
21.0000000020.00000000
22.0000000021.00000000
23.0000000022.00000000
24.0000000023.00000000

Advertisement

How this calculator works

A positive modulus gives residues from zero through one less than the cycle size. Clock mode uses 24 positions. List mode treats the first item as index zero. Integer mode accepts long digit strings without converting them to floating point. The table follows forward steps from the start, up to 24 steps; the offset result may involve many more revolutions.

Formula

r = x - m floor(x/m), with 0 ≤ r < m. For a clock x=start+offset and m=24; for a list m=length. A nonpositive equivalent is r-m when r is nonzero.

Worked example

Starting at 23:00 and adding four whole hours gives 27 modulo 24 = 3, or 03:00. Starting at list index 1 and moving backwards four places in a five-item list gives -3 modulo 5 = 2.

Advertisement

Frequently asked questions

Does clock mode include minutes?

It handles whole hours only. For finer clock arithmetic, convert the task to whole minutes and use a suitable modulus in integer mode.

Why is -3 modulo 5 equal to 2?

Adding one cycle of five reaches 2. Both values identify the same position in a five-position cycle.

Is this a scheduling or timezone tool?

No. It wraps numerical positions. Dates, daylight saving changes and elapsed real time require a calendar-aware calculation.

Sources

Advertisement