Function spinoso_math::lgamma[][src]

pub fn lgamma(value: f64) -> Result<(f64, i32), DomainError>
Expand description

Calculates the logarithmic gamma of value and the sign of gamma of value.

lgamma is same as:

[Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]

but avoids overflow of gamma for large values.


use spinoso_math as math;
assert_eq!(math::lgamma(0.0), Ok((f64::INFINITY, 1)));



If the given value is negative infinity, an error is returned.