Category talk:Wren-math: Difference between revisions

Content added Content deleted
(Bug fixes, restoration of static Math.min/max methods and addition of Math.atan.)
(→‎Source code: Ensure consistency between types.)
Line 113: Line 113:
x = t
x = t
}
}
return x
return x.abs
}
}


// Returns the least common multiple of 'x' and 'y'.
// Returns the least common multiple of 'x' and 'y'.
static lcm(x, y) { (x*y).abs / gcd(x, y) }
static lcm(x, y) {
if (x == 0 && y == 0) return 0
return (x*y).abs / gcd(x, y)
}


// Returns the remainder when 'b' raised to the power 'e' is divided by 'm'.
// Returns the remainder when 'b' raised to the power 'e' is divided by 'm'.