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

Commit ff51032

Browse files
committed
Add missing no_panic and inline annotations
1 parent f43bc0d commit ff51032

32 files changed

+80
-0
lines changed

src/math/acosh.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3
77
/// Calculates the inverse hyperbolic cosine of `x`.
88
/// Is defined as `log(x + sqrt(x*x-1))`.
99
/// `x` must be a number greater than or equal to 1.
10+
#[inline]
11+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
1012
pub fn acosh(x: f64) -> f64 {
1113
let u = x.to_bits();
1214
let e = ((u >> 52) as usize) & 0x7ff;

src/math/acoshf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const LN2: f32 = 0.693147180559945309417232121458176568;
77
/// Calculates the inverse hyperbolic cosine of `x`.
88
/// Is defined as `log(x + sqrt(x*x-1))`.
99
/// `x` must be a number greater than or equal to 1.
10+
#[inline]
11+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
1012
pub fn acoshf(x: f32) -> f32 {
1113
let u = x.to_bits();
1214
let a = u & 0x7fffffff;

src/math/asinh.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3
77
///
88
/// Calculates the inverse hyperbolic sine of `x`.
99
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
10+
#[inline]
11+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
1012
pub fn asinh(mut x: f64) -> f64 {
1113
let mut u = x.to_bits();
1214
let e = ((u >> 52) as usize) & 0x7ff;

src/math/asinhf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const LN2: f32 = 0.693147180559945309417232121458176568;
77
///
88
/// Calculates the inverse hyperbolic sine of `x`.
99
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
10+
#[inline]
11+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
1012
pub fn asinhf(mut x: f32) -> f32 {
1113
let u = x.to_bits();
1214
let i = u & 0x7fffffff;

src/math/atanh.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use super::log1p;
55
///
66
/// Calculates the inverse hyperbolic tangent of `x`.
77
/// Is defined as `log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2`.
8+
#[inline]
9+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
810
pub fn atanh(x: f64) -> f64 {
911
let u = x.to_bits();
1012
let e = ((u >> 52) as usize) & 0x7ff;

src/math/atanhf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use super::log1pf;
55
///
66
/// Calculates the inverse hyperbolic tangent of `x`.
77
/// Is defined as `log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2`.
8+
#[inline]
9+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
810
pub fn atanhf(mut x: f32) -> f32 {
911
let mut u = x.to_bits();
1012
let sign = (u >> 31) != 0;

src/math/copysign.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
///
33
/// Constructs a number with the magnitude (absolute value) of its
44
/// first argument, `x`, and the sign of its second argument, `y`.
5+
#[inline]
6+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
57
pub fn copysign(x: f64, y: f64) -> f64 {
68
let mut ux = x.to_bits();
79
let uy = y.to_bits();

src/math/copysignf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
///
33
/// Constructs a number with the magnitude (absolute value) of its
44
/// first argument, `x`, and the sign of its second argument, `y`.
5+
#[inline]
6+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
57
pub fn copysignf(x: f32, y: f32) -> f32 {
68
let mut ux = x.to_bits();
79
let uy = y.to_bits();

src/math/erf.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ fn erfc2(ix: u32, mut x: f64) -> f64 {
219219
/// Calculates an approximation to the “error function”, which estimates
220220
/// the probability that an observation will fall within x standard
221221
/// deviations of the mean (assuming a normal distribution).
222+
#[inline]
223+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
222224
pub fn erf(x: f64) -> f64 {
223225
let r: f64;
224226
let s: f64;
@@ -268,6 +270,8 @@ pub fn erf(x: f64) -> f64 {
268270
/// Is `1 - erf(x)`. Is computed directly, so that you can use it to avoid
269271
/// the loss of precision that would result from subtracting
270272
/// large probabilities (on large `x`) from 1.
273+
#[inline]
274+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
271275
pub fn erfc(x: f64) -> f64 {
272276
let r: f64;
273277
let s: f64;

src/math/erff.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ fn erfc2(mut ix: u32, mut x: f32) -> f32 {
130130
/// Calculates an approximation to the “error function”, which estimates
131131
/// the probability that an observation will fall within x standard
132132
/// deviations of the mean (assuming a normal distribution).
133+
#[inline]
134+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
133135
pub fn erff(x: f32) -> f32 {
134136
let r: f32;
135137
let s: f32;
@@ -179,6 +181,8 @@ pub fn erff(x: f32) -> f32 {
179181
/// Is `1 - erf(x)`. Is computed directly, so that you can use it to avoid
180182
/// the loss of precision that would result from subtracting
181183
/// large probabilities (on large `x`) from 1.
184+
#[inline]
185+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
182186
pub fn erfcf(x: f32) -> f32 {
183187
let r: f32;
184188
let s: f32;

0 commit comments

Comments
 (0)