Category talk:Wren-math: Difference between revisions
Content added Content deleted
(→Source code: Removed some private methods which are no longer used.) |
(→Source code: Added Math.lgamma method.) |
||
Line 83: | Line 83: | ||
for (i in 0..7) sum = sum + p[i+1]/(x + i) |
for (i in 0..7) sum = sum + p[i+1]/(x + i) |
||
return 2.sqrt * Num.pi.sqrt * t.pow(x-0.5) * (-t).exp * sum |
return 2.sqrt * Num.pi.sqrt * t.pow(x-0.5) * (-t).exp * sum |
||
} |
|||
// The natural logarithm of the absolute value of gamma(x). |
|||
static lgamma(x) { |
|||
if (x == 1 || x == 2) return 0 |
|||
return Math.gamma(x).abs.log |
|||
} |
} |
||