Math.radians = (degrees) ->
degrees * Math.PI / 180Compute conversion from degrees to radians.
Math.radians = (degrees) ->
degrees * Math.PI / 180Compute conversion from radians to degrees.
Math.degrees = (radians) ->
radians * 180 / Math.PIObtain the sign of the given number.
Math.sign = (num) ->
if num
if num < 0
return -1
else
return 1
else
return 0Compute conversion from degrees to radians.
Math.factorial = (x) ->
if x < 2
return 1
else
return Math.factorial(x-1)*xCompute the base-10 logarithm of x.
Math.log10 = (x) ->
Math.log(x) / Math.LN10Compute the error function of x.
Math.erf = (x) ->Constants
a1 = 0.254829592
a2 = -0.284496736
a3 = 1.421413741
a4 = -1.453152027
a5 = 1.061405429
p = 0.3275911Save the sign of x
sign = 1
sign = -1 if x < 0
x = Math.abs(x)Formula 7.1.26 from:
t = 1.0 / (1.0 + p * x)
y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.exp(-x * x)
sign * y