Category talk:Wren-math: Difference between revisions

Bug fixes, restoration of static Math.min/max methods and addition of Math.atan.
(→‎Source code: Removed a constant which is now in the core library.)
(Bug fixes, restoration of static Math.min/max methods and addition of Math.atan.)
Line 14:
 
// Hyperbolic trig functions.
static sinh(x) { (x.exp(x) - exp(-x).exp)/2 } // sine
static cosh(x) { (x.exp(x) + exp(-x).exp)/2 } // cosine
static tanh(x) { sinh(x)/cosh(x) } // tangent
 
Line 82:
var sum = p[0]
for (i in 0..7) sum = sum + p[i+1]/(x + i)
return 2.sqrt * Num.pi.sqrt * t.pow(x-0.5) * Math.exp(-t).exp * sum
}
 
// Static alternatives to instance methods in Num class.
// Clearer when both arguments are complex expressions.
static min(x, y) { (x < y) ? x : y }
static max(x, y) { (x > y) ? x : y }
static atan(x, y) { x.atan(y) }
}
 
9,476

edits