Should probably just put all these simple math functions in math.js.