Add some more basic docstrings (#352)
* Add docstrings to the tgamma functions * Add docstrings to the lgamma functions * Add docstrings to trunc * Add docstrings to exp10 functions
This commit is contained in:
parent
0f9503532b
commit
9a9e47798f
8 changed files with 14 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ const P10: &[f64] = &[
|
|||
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15,
|
||||
];
|
||||
|
||||
/// Calculates 10 raised to the power of `x` (f64).
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn exp10(x: f64) -> f64 {
|
||||
let (mut y, n) = modf(x);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const LN10_F64: f64 = 3.32192809488736234787031942948939;
|
|||
const P10: &[f32] =
|
||||
&[1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7];
|
||||
|
||||
/// Calculates 10 raised to the power of `x` (f32).
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn exp10f(x: f32) -> f32 {
|
||||
let (mut y, n) = modff(x);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
use super::lgamma_r;
|
||||
|
||||
/// The natural logarithm of the
|
||||
/// [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f64).
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn lgamma(x: f64) -> f64 {
|
||||
lgamma_r(x).0
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
use super::lgammaf_r;
|
||||
|
||||
/// The natural logarithm of the
|
||||
/// [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f32).
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn lgammaf(x: f32) -> f32 {
|
||||
lgammaf_r(x).0
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ fn s(x: f64) -> f64 {
|
|||
return num / den;
|
||||
}
|
||||
|
||||
/// The [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f64).
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn tgamma(mut x: f64) -> f64 {
|
||||
let u: u64 = x.to_bits();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use super::tgamma;
|
||||
|
||||
/// The [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f32).
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn tgammaf(x: f32) -> f32 {
|
||||
tgamma(x as f64) as f32
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
use core::f64;
|
||||
|
||||
/// Rounds the number toward 0 to the closest integral value (f64).
|
||||
///
|
||||
/// This effectively removes the decimal part of the number, leaving the integral part.
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn trunc(x: f64) -> f64 {
|
||||
select_implementation! {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
use core::f32;
|
||||
|
||||
/// Rounds the number toward 0 to the closest integral value (f32).
|
||||
///
|
||||
/// This effectively removes the decimal part of the number, leaving the integral part.
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn truncf(x: f32) -> f32 {
|
||||
select_implementation! {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue