{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"modulo"},"result":{"entity_type":"calculator","id":"modulo","calculator_id":"modulo","canonical_url":"https://tttkmbb.com/math/modulo","name":"Modulo Calculator","title":"Modulo Calculator – Remainder and Quotient (Truncated, Floored and Euclidean Conventions)","category":"math","category_name":"Math","tool_name":"calculate_modulo","featured_mcp_tool":false,"description":"Divides one number by another and reports the remainder under the three common sign conventions (truncated as in C/JavaScript, floored as in Python, and the non-negative Euclidean modulo) together with the integer quotient.","use_when":"You need a mod b, the remainder of a division, or want to know how different programming languages treat negative operands.","do_not_use_when":"You need the prime factors or divisors of a number (use prime-factorization) or a change of number base (use base-converter).","inputs":[{"name":"dividend","label":"Dividend (a)","type":"number","required":true,"min":-1000000000000000,"max":1000000000000000,"description":"The number being divided. Integers are exact; decimals are allowed.","example":17},{"name":"divisor","label":"Divisor (b)","type":"number","required":true,"min":-1000000000000000,"max":1000000000000000,"description":"The number to divide by; must not be 0.","example":5}],"outputs":[{"name":"remainder","label":"Remainder (truncated, sign of dividend)","type":"number","decimals":10,"description":"a − b × trunc(a / b): the % operator of C, Java and JavaScript."},{"name":"quotient","label":"Integer quotient (truncated)","type":"number","decimals":0,"description":"trunc(a / b), rounded toward zero."},{"name":"floored_modulo","label":"Floored modulo (sign of divisor)","type":"number","decimals":10,"description":"a − b × ⌊a / b⌋: the % operator of Python and the mod of spreadsheets."},{"name":"modulo","label":"Euclidean modulo (non-negative)","type":"number","decimals":10,"description":"The mathematical residue in [0, |b|): a − |b| × ⌊a / |b|⌋."},{"name":"is_divisible","label":"Divisible","type":"boolean","decimals":4,"description":"true when the remainder is 0."},{"name":"expression","label":"Division identity","type":"string","decimals":4,"description":"a = b × quotient + remainder with the truncated convention."}],"input_schema":{"type":"object","properties":{"dividend":{"description":"The number being divided. Integers are exact; decimals are allowed.","type":"number","minimum":-1000000000000000,"maximum":1000000000000000,"examples":[17]},"divisor":{"description":"The number to divide by; must not be 0.","type":"number","minimum":-1000000000000000,"maximum":1000000000000000,"examples":[5]}},"additionalProperties":false,"required":["dividend","divisor"]},"output_schema":{"type":"object","properties":{"remainder":{"description":"a − b × trunc(a / b): the % operator of C, Java and JavaScript.","type":"number"},"quotient":{"description":"trunc(a / b), rounded toward zero.","type":"number"},"floored_modulo":{"description":"a − b × ⌊a / b⌋: the % operator of Python and the mod of spreadsheets.","type":"number"},"modulo":{"description":"The mathematical residue in [0, |b|): a − |b| × ⌊a / |b|⌋.","type":"number"},"is_divisible":{"description":"true when the remainder is 0.","type":"boolean"},"expression":{"description":"a = b × quotient + remainder with the truncated convention.","type":"string"}}},"formula":"truncated: r = a − b·trunc(a/b); floored: r = a − b·⌊a/b⌋; Euclidean: r = a − |b|·⌊a/|b|⌋ (0 ≤ r < |b|)","sources":[{"name":"Wikipedia – Modulo","url":"https://en.wikipedia.org/wiki/Modulo","type":"reference","retrieved_at":"2026-09-23"},{"name":"Wikipedia – Euclidean division","url":"https://en.wikipedia.org/wiki/Euclidean_division","type":"reference","retrieved_at":"2026-09-23"},{"name":"Wolfram MathWorld – Mod","url":"https://mathworld.wolfram.com/Mod.html","type":"reference","retrieved_at":"2026-09-23"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"17 mod 5","inputs":{"dividend":17,"divisor":5},"expected":{"remainder":2,"quotient":3,"floored_modulo":2,"modulo":2,"is_divisible":false,"expression":"17 = 5 × 3 + 2"},"url":"https://tttkmbb.com/api/v1/calculate/modulo?dividend=17&divisor=5"},{"name":"−7 mod 3","inputs":{"dividend":-7,"divisor":3},"expected":{"remainder":-1,"quotient":-2,"floored_modulo":2,"modulo":2,"is_divisible":false},"url":"https://tttkmbb.com/api/v1/calculate/modulo?dividend=-7&divisor=3"}],"faq":[{"q":"Why does −7 mod 3 give both −1 and 2?","a":"Languages disagree on the sign: C, Java and JavaScript return −1 (remainder takes the sign of the dividend), Python and Excel return 2 (sign of the divisor). The Euclidean modulo is always non-negative."},{"q":"Does it work with decimals?","a":"Yes, e.g. 7.5 mod 2 = 1.5. Because inputs are binary floating-point numbers, results like 0.3 mod 0.1 may show tiny rounding artefacts."}],"tags":["modulo","mod","remainder","modulus","a mod b","divisibility"],"related":[{"calculator_id":"gcd-lcm","reason":"The Euclidean algorithm is built from repeated modulo."},{"calculator_id":"base-converter","reason":"Base conversion uses repeated division with remainder."},{"calculator_id":"day-of-week","reason":"Calendar arithmetic is modulo 7."}],"links":{"html":"https://tttkmbb.com/math/modulo","markdown":"https://tttkmbb.com/math/modulo.md","json":"https://tttkmbb.com/math/modulo.json","api":"https://tttkmbb.com/api/v1/calculate/modulo","schema":"https://tttkmbb.com/api/v1/calculators/modulo","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:24:36Z","next_actions":[{"tool":"run_calculator","calculator_id":"modulo","reason":"Run Modulo Calculator with the inputs above."}],"links":{"markdown":"https://tttkmbb.com/math/modulo.md"}}