8000 Add basic docstrings to some functions by JSorngard · Pull Request #337 · rust-lang/libm · GitHub
[go: up one dir, main page]

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

Add basic docstrings to some functions #337

Merged
merged 12 commits into from
Oct 28, 2024
Merged
Prev Previous commit
Next Next commit
Specify argument bit-size for logarithms
  • Loading branch information
JSorngard committed Oct 28, 2024
commit 4a1e6272cf372729ce8cd5b352af5abdccd3ec9c
2 changes: 1 addition & 1 deletion src/math/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */

/// The natural logarithm of `x`.
/// The natural logarithm of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log(mut x: f64) -> f64 {
let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54
Expand Down
2 changes: 1 addition & 1 deletion src/math/log10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */

/// The base 10 logarithm of `x`.
/// The base 10 logarithm of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log10(mut x: f64) -> f64 {
let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54
Expand Down
2 changes: 1 addition & 1 deletion src/math/log10f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */
const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */

/// The base 10 logarithm of `x`.
/// The base 10 logarithm of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log10f(mut x: f32) -> f32 {
let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25
Expand Down
2 changes: 1 addition & 1 deletion src/math/log1p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */

/// The natural logarithm of 1+`x`.
/// The natural logarithm of 1+`x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log1p(x: f64) -> f64 {
let mut ui: u64 = x.to_bits();
Expand Down
2 changes: 1 addition & 1 deletion src/math/log1pf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */
const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */

/// The natural logarithm of 1+`x`.
/// The natural logarithm of 1+`x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log1pf(x: f32) -> f32 {
let mut ui: u32 = x.to_bits();
Expand Down
2 changes: 1 addition & 1 deletion
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */

/// The base 2 logarithm of `x`.
/// The base 2 logarithm of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log2(mut x: f64) -> f64 {
let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54
Expand Down
2 changes: 1 addition & 1 deletion src/math/log2f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */
const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */

/// The base 2 logarithm of `x`.
/// The base 2 logarithm of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn log2f(mut x: f32) -> f32 {
let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25
Expand Down
2 changes: 1 addition & 1 deletion src/math/logf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */
const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */

/// The natural logarithm of `x`.
/// The natural logarithm of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn logf(mut x: f32) -> f32 {
let x1p25 = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25
Expand Down
0