Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JSorngard committed Dec 18, 2024
2 parents e5f977a + 06628e3 commit e705f22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/elementary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// correct sqrt/ln at the caller does not add extra code, but skips an extra indirection.

#[inline(always)]
pub(crate) fn sqrt(x: f64) -> f64 {
pub fn sqrt(x: f64) -> f64 {
#[cfg(feature = "std")]
{
x.sqrt()
Expand All @@ -24,7 +24,7 @@ pub(crate) fn sqrt(x: f64) -> f64 {
}

#[inline(always)]
pub(crate) fn sqrtf(x: f32) -> f32 {
pub fn sqrtf(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.sqrt()
Expand All @@ -42,7 +42,7 @@ pub(crate) fn sqrtf(x: f32) -> f32 {
}

#[inline(always)]
pub(crate) fn ln(x: f64) -> f64 {
pub fn ln(x: f64) -> f64 {
#[cfg(feature = "std")]
{
x.ln()
Expand All @@ -60,7 +60,7 @@ pub(crate) fn ln(x: f64) -> f64 {
}

#[inline(always)]
pub(crate) fn lnf(x: f32) -> f32 {
pub fn lnf(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.ln()
Expand Down
20 changes: 6 additions & 14 deletions src/rational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
/// The first set of coefficients are for the polynomial in the numerator
/// and the second set are the coefficients of the polynomial in the denominator.
#[inline(always)]
pub(crate) fn rational_3_over_3(
x: f64,
[n0, n1, n2, n3]: [f64; 4],
[d0, d1, d2, d3]: [f64; 4],
) -> f64 {
pub fn rational_3_over_3(x: f64, [n0, n1, n2, n3]: [f64; 4], [d0, d1, d2, d3]: [f64; 4]) -> f64 {
(n0 + x * (n1 + x * (n2 + x * n3))) / (d0 + x * (d1 + x * (d2 + x * d3)))
}

Expand All @@ -20,11 +16,7 @@ pub(crate) fn rational_3_over_3(
/// The first set of coefficients are for the polynomial in the numerator
/// and the second set are the coefficients of the polynomial in the denominator.
#[inline(always)]
pub(crate) fn rational_3_over_3f(
x: f32,
[n0, n1, n2, n3]: [f32; 4],
[d0, d1, d2, d3]: [f32; 4],
) -> f32 {
pub fn rational_3_over_3f(x: f32, [n0, n1, n2, n3]: [f32; 4], [d0, d1, d2, d3]: [f32; 4]) -> f32 {
(n0 + x * (n1 + x * (n2 + x * n3))) / (d0 + x * (d1 + x * (d2 + x * d3)))
}

Expand All @@ -33,7 +25,7 @@ pub(crate) fn rational_3_over_3f(
/// The first set of coefficients are for the polynomial in the numerator
/// and the second set are the coefficients of the polynomial in the denominator.
#[inline(always)]
pub(crate) fn rational_4_over_3(
pub fn rational_4_over_3(
x: f64,
[n0, n1, n2, n3, n4]: [f64; 5],
[d0, d1, d2, d3]: [f64; 4],
Expand All @@ -46,7 +38,7 @@ pub(crate) fn rational_4_over_3(
/// The first set of coefficients are for the polynomial in the numerator
/// and the second set are the coefficients of the polynomial in the denominator.
#[inline(always)]
pub(crate) fn rational_4_over_3f(
pub fn rational_4_over_3f(
x: f32,
[n0, n1, n2, n3, n4]: [f32; 5],
[d0, d1, d2, d3]: [f32; 4],
Expand All @@ -59,7 +51,7 @@ pub(crate) fn rational_4_over_3f(
/// The first set of coefficients are for the polynomial in the numerator
/// and the second set are the coefficients of the polynomial in the denominator.
#[inline(always)]
pub(crate) fn rational_7_over_7(
pub fn rational_7_over_7(
x: f64,
[n0, n1, n2, n3, n4, n5, n6, n7]: [f64; 8],
[d0, d1, d2, d3, d4, d5, d6, d7]: [f64; 8],
Expand All @@ -73,7 +65,7 @@ pub(crate) fn rational_7_over_7(
/// The first set of coefficients are for the polynomial in the numerator
/// and the second set are the coefficients of the polynomial in the denominator.
#[inline(always)]
pub(crate) fn rational_8_over_7(
pub fn rational_8_over_7(
x: f64,
[n0, n1, n2, n3, n4, n5, n6, n7, n8]: [f64; 9],
[d0, d1, d2, d3, d4, d5, d6, d7]: [f64; 8],
Expand Down

0 comments on commit e705f22

Please sign in to comment.