Every line of 'mdn reduce' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
22 export function reduce(n: Integer, d: Natural): Rational { 23 return nonZeroInteger.fromInteger(n).fold(zero, n => { 24 const divisor = natural.gcd(nonZeroInteger.abs(n), d) 25 const n2 = integer.div(n, divisor) 26 const d2 = natural.div(d, divisor) 27 return [n2, d2] 28 }) 29 }