Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Add some more basic docstrings #352

Merged
merged 9 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/math/exp10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/math/exp10f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/math/lgamma.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/math/lgammaf.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/math/tgamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/math/tgammaf.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/math/trunc.rs
Original file line number Diff line number Diff line change
@@ -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! {
Expand Down
3 changes: 3 additions & 0 deletions src/math/truncf.rs
Original file line number Diff line number Diff line change
@@ -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! {
Expand Down