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

Commit 47cb891

Browse files
committed
Add docs
1 parent efcc86b commit 47cb891

38 files changed

+185
-2
lines changed

src/math/acos.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ fn r(z: f64) -> f64 {
5555
p / q
5656
}
5757

58+
/// Arccosine (f64)
59+
///
60+
/// Computes the inverse cosine (arc cosine) of the input value.
61+
/// Arguments must be in the range -1 to 1.
62+
/// Returns values in radians, in the range of 0 to pi.
5863
#[inline]
5964
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6065
pub fn acos(x: f64) -> f64 {

src/math/acosf.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ fn r(z: f32) -> f32 {
2929
p / q
3030
}
3131

32+
/// Arccosine (f32)
33+
///
34+
/// Computes the inverse cosine (arc cosine) of the input value.
35+
/// Arguments must be in the range -1 to 1.
36+
/// Returns values in radians, in the range of 0 to pi.
3237
#[inline]
3338
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
3439
pub fn acosf(x: f32) -> f32 {

src/math/acosh.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ use super::{log, log1p, sqrt};
22

33
const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa39ef*/
44

5-
/* acosh(x) = log(x + sqrt(x*x-1)) */
5+
/// Inverse hyperbolic cosine (f64)
6+
///
7+
/// Calculates the inverse hyperbolic cosine of `x`.
8+
/// Is defined as `log(x + sqrt(x*x-1))`.
9+
/// `x` must be a number greater than or equal to 1.
610
pub fn acosh(x: f64) -> f64 {
711
let u = x.to_bits();
812
let e = ((u >> 52) as usize) & 0x7ff;

src/math/acoshf.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ use super::{log1pf, logf, sqrtf};
22

33
const LN2: f32 = 0.693147180559945309417232121458176568;
44

5-
/* acosh(x) = log(x + sqrt(x*x-1)) */
5+
/// Inverse hyperbolic cosine (f32)
6+
///
7+
/// Calculates the inverse hyperbolic cosine of `x`.
8+
/// Is defined as `log(x + sqrt(x*x-1))`.
9+
/// `x` must be a number greater than or equal to 1.
610
pub fn acoshf(x: f32) -> f32 {
711
let u = x.to_bits();
812
let a = u & 0x7fffffff;

src/math/asin.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ fn comp_r(z: f64) -> f64 {
6262
p / q
6363
}
6464

65+
/// Arcsine (f64)
66+
///
67+
/// Computes the inverse sine (arc sine) of the argument `x`.
68+
/// Arguments to asin must be in the range -1 to 1.
69+
/// Returns values in radians, in the range of -pi/2 to pi/2.
6570
#[inline]
6671
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6772
pub fn asin(mut x: f64) -> f64 {

src/math/asinf.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ fn r(z: f32) -> f32 {
3131
p / q
3232
}
3333

34+
/// Arcsine (f32)
35+
///
36+
/// Computes the inverse sine (arc sine) of the argument `x`.
37+
/// Arguments to asin must be in the range -1 to 1.
38+
/// Returns values in radians, in the range of -pi/2 to pi/2.
3439
#[inline]
3540
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
3641
pub fn asinf(mut x: f32) -> f32 {

src/math/asinh.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ use super::{log, log1p, sqrt};
33
const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa39ef*/
44

55
/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */
6+
/// Inverse hyperbolic sine (f64)
7+
///
8+
/// Calculates the inverse hyperbolic sine of `x`.
9+
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
610
pub fn asinh(mut x: f64) -> f64 {
711
let mut u = x.to_bits();
812
let e = ((u >> 52) as usize) & 0x7ff;

src/math/asinhf.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ use super::{log1pf, logf, sqrtf};
33
const LN2: f32 = 0.693147180559945309417232121458176568;
44

55
/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */
6+
/// Inverse hyperbolic sine (f32)
7+
///
8+
/// Calculates the inverse hyperbolic sine of `x`.
9+
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
610
pub fn asinhf(mut x: f32) -> f32 {
711
let u = x.to_bits();
812
let i = u & 0x7fffffff;

src/math/atan.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ const AT: [f64; 11] = [
6060
1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */
6161
];
6262

63+
/// Arctangent (f64)
64+
///
65+
/// Computes the inverse tangent (arc tangent) of the input value.
66+
/// Returns a value in radians, in the range of -pi/2 to pi/2.
6367
#[inline]
6468
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6569
pub fn atan(x: f64) -> f64 {

src/math/atan2.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ use super::fabs;
4343
const PI: f64 = 3.1415926535897931160E+00; /* 0x400921FB, 0x54442D18 */
4444
const PI_LO: f64 = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
4545

46+
/// Arctangent of y/x (f64)
47+
///
48+
/// Computes the inverse tangent (arc tangent) of `y/x`.
49+
/// Produces the correct result even for angles near pi/2 or -pi/2 (that is, when `x` is near 0).
50+
/// Returns a value in radians, in the range of -pi to pi.
4651
#[inline]
4752
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
4853
pub fn atan2(y: f64, x: f64) -> f64 {

0 commit comments

Comments
 (0)