spinoso_math

Function log10

Source
pub fn log10(value: f64) -> Result<f64, DomainError>
Expand description

Returns the base 10 logarithm of the number.

Domain: (0, INFINITY)

Codomain: (-INFINITY, INFINITY)

§Examples

use spinoso_math as math;
assert_eq!(math::log10(1.0), Ok(0.0));
assert_eq!(math::log10(10.0), Ok(1.0));
assert_eq!(math::log10(1e100), Ok(100.0));

assert_eq!(math::log10(0.0), Ok(f64::NEG_INFINITY));
assert!(math::log10(-0.1).is_err());

assert!(matches!(math::log10(f64::NAN), Ok(result) if result.is_nan()));

§Errors

If the result of computing the logarithm is NAN, a domain error is returned.