UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

13 lines (12 loc) 503 B
import { pythonMod } from "../_helpers/_operator.js"; export function mod(a, b) { // discuss at: https://locutus.io/python/operator/mod/ // parity verified: Python 3.12 // original by: Kevin van Zonneveld (https://kvz.io) // note 1: Uses Python's modulo semantics, where the remainder follows the divisor sign. // example 1: mod(7, 3) // returns 1: 1 // example 2: mod(-7, 3) // returns 2: 2 return pythonMod(a, b, 'mod'); }