You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

libm

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libm - cargo Package Compare versions

Comparing version
0.2.9
to
0.2.10
.git-blame-ignore-revs

Sorry, the diff of this file is not supported yet

+5
# This matches rustc
style_edition = "2024"
use_small_heuristics = "Max"
group_imports = "StdExternalCrate"
imports_granularity = "Module"
+1
-1
{
"git": {
"sha1": "114f90ff8a7708586e58dd7c0ed7d2c3f7a91ab1"
"sha1": "5c948cb8f05ac30d3d2bc9e51f6f93a41ce877bd"
},
"path_in_vcs": ""
}

@@ -5,6 +5,6 @@ use std::env;

println!("cargo:rerun-if-changed=build.rs");
println!("cargo::rustc-check-cfg=cfg(assert_no_panic)");
println!("cargo::rustc-check-cfg=cfg(feature, values(\"unstable\"))");
println!("cargo:rustc-check-cfg=cfg(assert_no_panic)");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"unstable\"))");
println!("cargo::rustc-check-cfg=cfg(feature, values(\"checked\"))");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"checked\"))");

@@ -11,0 +11,0 @@ #[allow(unexpected_cfgs)]

@@ -14,4 +14,5 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

edition = "2021"
rust-version = "1.63"
name = "libm"
version = "0.2.9"
version = "0.2.10"
authors = ["Jorge Aparicio <jorge@japaric.io>"]

@@ -18,0 +19,0 @@ build = "build.rs"

@@ -11,2 +11,8 @@ # Changelog

## [0.2.10](https://github.com/rust-lang/libm/compare/libm-v0.2.9...libm-v0.2.10) - 2024-10-28
### Other
- Set the MSRV to 1.63 and test this in CI
## [0.2.9](https://github.com/rust-lang/libm/compare/libm-v0.2.8...libm-v0.2.9) - 2024-10-26

@@ -13,0 +19,0 @@

@@ -37,2 +37,6 @@ # `libm`

## Minimum Rust version policy
This crate supports rustc 1.63 and newer.
## License

@@ -39,0 +43,0 @@

@@ -20,5 +20,6 @@ //! libm in pure Rust

pub use self::math::*;
pub use libm_helper::*;
pub use self::math::*;
/// Approximate equality with 1 ULP of tolerance

@@ -33,7 +34,3 @@ #[doc(hidden)]

if err <= 1 {
Ok(())
} else {
Err(err as u32)
}
if err <= 1 { Ok(()) } else { Err(err as u32) }
}

@@ -50,8 +47,4 @@ }

if err <= 1 {
Ok(())
} else {
Err(err as u64)
}
if err <= 1 { Ok(()) } else { Err(err as u64) }
}
}

@@ -114,7 +114,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_asin.c */

}
if hx >> 31 != 0 {
-x
} else {
x
}
if hx >> 31 != 0 { -x } else { x }
}

@@ -67,7 +67,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_asinf.c */

x = (PIO2 - 2. * (s + s * (r(z) as f64))) as f32;
if (hx >> 31) != 0 {
-x
} else {
x
}
if (hx >> 31) != 0 { -x } else { x }
}

@@ -35,7 +35,3 @@ use super::{log, log1p, sqrt};

if sign {
-x
} else {
x
}
if sign { -x } else { x }
}

@@ -34,7 +34,3 @@ use super::{log1pf, logf, sqrtf};

if sign {
-x
} else {
x
}
if sign { -x } else { x }
}

@@ -32,5 +32,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_atan.c */

use super::fabs;
use core::f64;
use super::fabs;
const ATANHI: [f64; 4] = [

@@ -132,7 +133,3 @@ 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */

if sign != 0 {
-z
} else {
z
}
if sign != 0 { -z } else { z }
}

@@ -142,5 +139,6 @@

mod tests {
use super::atan;
use core::f64;
use super::atan;
#[test]

@@ -147,0 +145,0 @@ fn sanity_check() {

@@ -40,4 +40,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_atan2.c */

use super::atan;
use super::fabs;
use super::{atan, fabs};

@@ -44,0 +43,0 @@ const PI: f64 = 3.1415926535897931160E+00; /* 0x400921FB, 0x54442D18 */

@@ -16,4 +16,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_atan2f.c */

use super::atanf;
use super::fabsf;
use super::{atanf, fabsf};

@@ -20,0 +19,0 @@ const PI: f32 = 3.1415927410e+00; /* 0x40490fdb */

@@ -32,9 +32,4 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_atanf.c */

const A_T: [f32; 5] = [
3.3333328366e-01,
-1.9999158382e-01,
1.4253635705e-01,
-1.0648017377e-01,
6.1687607318e-02,
];
const A_T: [f32; 5] =
[3.3333328366e-01, -1.9999158382e-01, 1.4253635705e-01, -1.0648017377e-01, 6.1687607318e-02];

@@ -108,7 +103,3 @@ /// Arctangent (f32)

let z = i!(ATAN_HI, id) - ((x * (s1 + s2) - i!(ATAN_LO, id)) - x);
if sign {
-z
} else {
z
}
if sign { -z } else { z }
}

@@ -32,7 +32,3 @@ use super::log1p;

if sign {
-y
} else {
y
}
if sign { -y } else { y }
}

@@ -32,7 +32,3 @@ use super::log1pf;

if sign {
-x
} else {
x
}
if sign { -x } else { x }
}

@@ -45,7 +45,3 @@ #![allow(unreachable_code)]

// y = int(x) - x, where int(x) is an integer neighbor of x
y = if (u >> 63) != 0 {
x - TOINT + TOINT - x
} else {
x + TOINT - TOINT - x
};
y = if (u >> 63) != 0 { x - TOINT + TOINT - x } else { x + TOINT - TOINT - x };
// special case because of non-nearest rounding modes

@@ -56,7 +52,3 @@ if e < 0x3ff {

}
if y < 0. {
x + y + 1.
} else {
x + y
}
if y < 0. { x + y + 1. } else { x + y }
}

@@ -66,5 +58,6 @@

mod tests {
use super::*;
use core::f64::*;
use super::*;
#[test]

@@ -71,0 +64,0 @@ fn sanity_check() {

@@ -47,5 +47,6 @@ use core::f32;

mod tests {
use super::*;
use core::f32::*;
use super::*;
#[test]

@@ -52,0 +53,0 @@ fn sanity_check() {

@@ -17,6 +17,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_cosf.c */

use core::f64::consts::FRAC_PI_2;
use super::{k_cosf, k_sinf, rem_pio2f};
use core::f64::consts::FRAC_PI_2;
/* Small multiples of pi/2 rounded to double precision. */

@@ -23,0 +23,0 @@ const C1_PIO2: f64 = 1. * FRAC_PI_2; /* 0x3FF921FB, 0x54442D18 */

@@ -1,4 +0,2 @@

use super::exp;
use super::expm1;
use super::k_expo2;
use super::{exp, expm1, k_expo2};

@@ -5,0 +3,0 @@ /// Hyperbolic cosine (f64)

@@ -1,4 +0,2 @@

use super::expf;
use super::expm1f;
use super::k_expo2f;
use super::{expf, expm1f, k_expo2f};

@@ -5,0 +3,0 @@ /// Hyperbolic cosine (f64)

@@ -259,7 +259,3 @@ use super::{exp, fabs, get_high_word, with_set_low_word};

if sign != 0 {
-y
} else {
y
}
if sign != 0 { -y } else { y }
}

@@ -314,7 +310,3 @@

let x1p_1022 = f64::from_bits(0x0010000000000000);
if sign != 0 {
2.0 - x1p_1022
} else {
x1p_1022 * x1p_1022
}
if sign != 0 { 2.0 - x1p_1022 } else { x1p_1022 * x1p_1022 }
}

@@ -170,7 +170,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_erff.c */

if sign != 0 {
-y
} else {
y
}
if sign != 0 { -y } else { y }
}

@@ -226,7 +222,3 @@

let x1p_120 = f32::from_bits(0x03800000);
if sign != 0 {
2.0 - x1p_120
} else {
x1p_120 * x1p_120
}
if sign != 0 { 2.0 - x1p_120 } else { x1p_120 * x1p_120 }
}

@@ -149,7 +149,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_exp.c */

y = 1. + (x * c / (2. - c) - lo + hi);
if k == 0 {
y
} else {
scalbn(y, k)
}
if k == 0 { y } else { scalbn(y, k) }
}

@@ -5,5 +5,4 @@ use super::{exp2, exp2f, modff};

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,
];
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];

@@ -10,0 +9,0 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -96,7 +96,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_expf.c */

let y = 1. + (x * c / (2. - c) - lo + hi);
if k == 0 {
y
} else {
scalbnf(y, k)
}
if k == 0 { y } else { scalbnf(y, k) }
}

@@ -129,7 +129,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_expm1f.c */

let uf = f32::from_bits(((0x7f - k) << 23) as u32); /* 2^-k */
if k < 23 {
(x - e + (1. - uf)) * twopk
} else {
(x - (e + uf) + 1.) * twopk
}
if k < 23 { (x - e + (1. - uf)) * twopk } else { (x - (e + uf) + 1.) * twopk }
}

@@ -21,5 +21,6 @@ use core::u64;

mod tests {
use super::*;
use core::f64::*;
use super::*;
#[test]

@@ -26,0 +27,0 @@ fn sanity_check() {

@@ -21,5 +21,6 @@ /// Absolute value (magnitude) (f32)

mod tests {
use super::*;
use core::f32::*;
use super::*;
#[test]

@@ -26,0 +27,0 @@ fn sanity_check() {

@@ -44,7 +44,3 @@ #![allow(unreachable_code)]

/* y = int(x) - x, where int(x) is an integer neighbor of x */
let y = if (ui >> 63) != 0 {
x - TOINT + TOINT - x
} else {
x + TOINT - TOINT - x
};
let y = if (ui >> 63) != 0 { x - TOINT + TOINT - x } else { x + TOINT - TOINT - x };
/* special case because of non-nearest rounding modes */

@@ -55,7 +51,3 @@ if e < 0x3ff {

}
if y > 0. {
x + y - 1.
} else {
x + y
}
if y > 0. { x + y - 1. } else { x + y }
}

@@ -65,5 +57,6 @@

mod tests {
use super::*;
use core::f64::*;
use super::*;
#[test]

@@ -70,0 +63,0 @@ fn sanity_check() {

@@ -47,5 +47,6 @@ use core::f32;

mod tests {
use super::*;
use core::f32::*;
use super::*;
#[test]

@@ -52,0 +53,0 @@ fn sanity_check() {

@@ -219,6 +219,3 @@ use core::{f32, f64};

fn fma_sbb() {
assert_eq!(
fma(-(1.0 - f64::EPSILON), f64::MIN, f64::MIN),
-3991680619069439e277
);
assert_eq!(fma(-(1.0 - f64::EPSILON), f64::MIN, f64::MIN), -3991680619069439e277);
}

@@ -228,7 +225,4 @@

fn fma_underflow() {
assert_eq!(
fma(1.1102230246251565e-16, -9.812526705433188e-305, 1.0894e-320),
0.0,
);
assert_eq!(fma(1.1102230246251565e-16, -9.812526705433188e-305, 1.0894e-320), 0.0,);
}
}

@@ -32,3 +32,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_fmaf.c */

use super::fenv::{
feclearexcept, fegetround, feraiseexcept, fetestexcept, FE_INEXACT, FE_TONEAREST, FE_UNDERFLOW,
FE_INEXACT, FE_TONEAREST, FE_UNDERFLOW, feclearexcept, fegetround, feraiseexcept, fetestexcept,
};

@@ -95,7 +95,3 @@

let neg = ui >> 63 != 0;
let err = if neg == (z as f64 > xy) {
xy - result + z as f64
} else {
z as f64 - result + xy
};
let err = if neg == (z as f64 > xy) { xy - result + z as f64 } else { z as f64 - result + xy };
if neg == (err < 0.0) {

@@ -102,0 +98,0 @@ ui += 1;

@@ -1,3 +0,2 @@

use core::f32;
use core::u32;
use core::{f32, u32};

@@ -4,0 +3,0 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -24,7 +24,3 @@ const FP_ILOGBNAN: i32 = -1 - 0x7fffffff;

force_eval!(0.0 / 0.0);
if (i << 12) != 0 {
FP_ILOGBNAN
} else {
i32::max_value()
}
if (i << 12) != 0 { FP_ILOGBNAN } else { i32::max_value() }
} else {

@@ -31,0 +27,0 @@ e - 0x3ff

@@ -24,7 +24,3 @@ const FP_ILOGBNAN: i32 = -1 - 0x7fffffff;

force_eval!(0.0 / 0.0);
if (i << 9) != 0 {
FP_ILOGBNAN
} else {
i32::max_value()
}
if (i << 9) != 0 { FP_ILOGBNAN } else { i32::max_value() }
} else {

@@ -31,0 +27,0 @@ e - 0x7f

@@ -247,7 +247,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_jn.c */

if sign {
-b
} else {
b
}
if sign { -b } else { b }
}

@@ -339,7 +335,3 @@

if sign {
-b
} else {
b
}
if sign { -b } else { b }
}

@@ -191,7 +191,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_jnf.c */

if sign {
-b
} else {
b
}
if sign { -b } else { b }
}

@@ -255,7 +251,3 @@

if sign {
-b
} else {
b
}
if sign { -b } else { b }
}

@@ -52,7 +52,3 @@ // origin: FreeBSD /usr/src/lib/msun/src/k_sin.c

let v = z * x;
if iy == 0 {
x + v * (S1 + z * r)
} else {
x - ((z * (0.5 * y - v * r) - y) - v * S1)
}
if iy == 0 { x + v * (S1 + z * r) } else { x - ((z * (0.5 * y - v * r) - y) - v * S1) }
}

@@ -120,7 +120,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_log1p.c */

if k < 54 {
c = if k >= 2 {
1. - (f64::from_bits(ui) - x)
} else {
x - (f64::from_bits(ui) - 1.)
};
c = if k >= 2 { 1. - (f64::from_bits(ui) - x) } else { x - (f64::from_bits(ui) - 1.) };
c /= f64::from_bits(ui);

@@ -127,0 +123,0 @@ } else {

@@ -75,7 +75,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_log1pf.c */

if k < 25 {
c = if k >= 2 {
1. - (f32::from_bits(ui) - x)
} else {
x - (f32::from_bits(ui) - 1.)
};
c = if k >= 2 { 1. - (f32::from_bits(ui) - x) } else { x - (f32::from_bits(ui) - 1.) };
c /= f32::from_bits(ui);

@@ -82,0 +78,0 @@ } else {

@@ -221,11 +221,9 @@ macro_rules! force_eval {

pub use self::coshf::coshf;
pub use self::erf::erf;
pub use self::erf::erfc;
pub use self::erff::erfcf;
pub use self::erff::erff;
pub use self::erf::{erf, erfc};
pub use self::erff::{erfcf, erff};
pub use self::exp::exp;
pub use self::exp2::exp2;
pub use self::exp2f::exp2f;
pub use self::exp10::exp10;
pub use self::exp10f::exp10f;
pub use self::exp2::exp2;
pub use self::exp2f::exp2f;
pub use self::expf::expf;

@@ -254,14 +252,8 @@ pub use self::expm1::expm1;

pub use self::ilogbf::ilogbf;
pub use self::j0::j0;
pub use self::j0::y0;
pub use self::j0f::j0f;
pub use self::j0f::y0f;
pub use self::j1::j1;
pub use self::j1::y1;
pub use self::j1f::j1f;
pub use self::j1f::y1f;
pub use self::jn::jn;
pub use self::jn::yn;
pub use self::jnf::jnf;
pub use self::jnf::ynf;
pub use self::j0::{j0, y0};
pub use self::j0f::{j0f, y0f};
pub use self::j1::{j1, y1};
pub use self::j1f::{j1f, y1f};
pub use self::jn::{jn, yn};
pub use self::jnf::{jnf, ynf};
pub use self::ldexp::ldexp;

@@ -274,4 +266,2 @@ pub use self::ldexpf::ldexpf;

pub use self::log::log;
pub use self::log10::log10;
pub use self::log10f::log10f;
pub use self::log1p::log1p;

@@ -281,2 +271,4 @@ pub use self::log1pf::log1pf;

pub use self::log2f::log2f;
pub use self::log10::log10;
pub use self::log10f::log10f;
pub use self::logf::logf;

@@ -283,0 +275,0 @@ pub use self::modf::modf;

@@ -162,14 +162,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_pow.c */

/* (|x|>1)**+-inf = inf,0 */
if hy >= 0 {
y
} else {
0.0
}
if hy >= 0 { y } else { 0.0 }
} else {
/* (|x|<1)**+-inf = 0,inf */
if hy >= 0 {
0.0
} else {
-y
}
if hy >= 0 { 0.0 } else { -y }
};

@@ -250,14 +242,6 @@ }

if ix < 0x3fefffff {
return if hy < 0 {
s * HUGE * HUGE
} else {
s * TINY * TINY
};
return if hy < 0 { s * HUGE * HUGE } else { s * TINY * TINY };
}
if ix > 0x3ff00000 {
return if hy > 0 {
s * HUGE * HUGE
} else {
s * TINY * TINY
};
return if hy > 0 { s * HUGE * HUGE } else { s * TINY * TINY };
}

@@ -460,7 +444,3 @@

assert!(
if expected.is_nan() {
res.is_nan()
} else {
pow(base, exponent) == expected
},
if expected.is_nan() { res.is_nan() } else { pow(base, exponent) == expected },
"{} ** {} was {} instead of {}",

@@ -475,9 +455,7 @@ base,

fn test_sets_as_base(sets: &[&[f64]], exponent: f64, expected: f64) {
sets.iter()
.for_each(|s| s.iter().for_each(|val| pow_test(*val, exponent, expected)));
sets.iter().for_each(|s| s.iter().for_each(|val| pow_test(*val, exponent, expected)));
}
fn test_sets_as_exponent(base: f64, sets: &[&[f64]], expected: f64) {
sets.iter()
.for_each(|s| s.iter().for_each(|val| pow_test(base, *val, expected)));
sets.iter().for_each(|s| s.iter().for_each(|val| pow_test(base, *val, expected)));
}

@@ -496,7 +474,3 @@

assert!(
if exp.is_nan() {
res.is_nan()
} else {
exp == res
},
if exp.is_nan() { res.is_nan() } else { exp == res },
"test for {} was {} instead of {}",

@@ -616,5 +590,4 @@ val,

// (negative anything ^ integer should be (-1 ^ integer) * (positive anything ^ integer))
(&[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS])
.iter()
.for_each(|int_set| {
(&[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS]).iter().for_each(
|int_set| {
int_set.iter().for_each(|int| {

@@ -625,3 +598,4 @@ test_sets(ALL, &|v: f64| pow(-v, *int), &|v: f64| {

})
});
},
);

@@ -628,0 +602,0 @@ // Negative base (imaginary results):

@@ -184,15 +184,7 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_powf.c */

if ix < 0x3f7ffff8 {
return if hy < 0 {
sn * HUGE * HUGE
} else {
sn * TINY * TINY
};
return if hy < 0 { sn * HUGE * HUGE } else { sn * TINY * TINY };
}
if ix > 0x3f800007 {
return if hy > 0 {
sn * HUGE * HUGE
} else {
sn * TINY * TINY
};
return if hy > 0 { sn * HUGE * HUGE } else { sn * TINY * TINY };
}

@@ -199,0 +191,0 @@

@@ -14,4 +14,3 @@ #![allow(unused_unsafe)]

use super::floor;
use super::scalbn;
use super::{floor, scalbn};

@@ -18,0 +17,0 @@ // initial value for jk

@@ -200,24 +200,12 @@ // origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2.c

let arg = force_eval!(arg);
assert_eq!(
rem_pio2(arg),
(2, -6.278329573009626e-7, -2.1125998133974653e-23)
);
assert_eq!(rem_pio2(arg), (2, -6.278329573009626e-7, -2.1125998133974653e-23));
let arg = 3.141592033207416;
let arg = force_eval!(arg);
assert_eq!(
rem_pio2(arg),
(2, -6.20382377148128e-7, -2.1125998133974653e-23)
);
assert_eq!(rem_pio2(arg), (2, -6.20382377148128e-7, -2.1125998133974653e-23));
let arg = 3.141592144966125;
let arg = force_eval!(arg);
assert_eq!(
rem_pio2(arg),
(2, -5.086236681942706e-7, -2.1125998133974653e-23)
);
assert_eq!(rem_pio2(arg), (2, -5.086236681942706e-7, -2.1125998133974653e-23));
let arg = 3.141592979431152;
let arg = force_eval!(arg);
assert_eq!(
rem_pio2(arg),
(2, 3.2584135866119817e-7, -2.1125998133974653e-23)
);
assert_eq!(rem_pio2(arg), (2, 3.2584135866119817e-7, -2.1125998133974653e-23));
}

@@ -224,0 +212,0 @@

@@ -17,6 +17,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2f.c */

use core::f64;
use super::rem_pio2_large;
use core::f64;
const TOINT: f64 = 1.5 / f64::EPSILON;

@@ -23,0 +23,0 @@

@@ -94,7 +94,3 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

let quo = if sx ^ sy { -(q as i32) } else { q as i32 };
if sx {
(-x, quo)
} else {
(x, quo)
}
if sx { (-x, quo) } else { (x, quo) }
}

@@ -101,0 +97,0 @@

@@ -92,7 +92,3 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

let quo = if sx ^ sy { -(q as i32) } else { q as i32 };
if sx {
(-x, quo)
} else {
(x, quo)
}
if sx { (-x, quo) } else { (x, quo) }
}

@@ -26,11 +26,3 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

if ans == 0.0 {
if is_positive {
0.0
} else {
-0.0
}
} else {
ans
}
if ans == 0.0 { if is_positive { 0.0 } else { -0.0 } } else { ans }
}

@@ -37,0 +29,0 @@ }

@@ -26,11 +26,3 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

if ans == 0.0 {
if is_positive {
0.0
} else {
-0.0
}
} else {
ans
}
if ans == 0.0 { if is_positive { 0.0 } else { -0.0 } } else { ans }
}

@@ -37,0 +29,0 @@ }

@@ -1,5 +0,5 @@

use super::copysign;
use super::trunc;
use core::f64;
use super::{copysign, trunc};
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -6,0 +6,0 @@ pub fn round(x: f64) -> f64 {

@@ -1,5 +0,5 @@

use super::copysignf;
use super::truncf;
use core::f32;
use super::{copysignf, truncf};
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -6,0 +6,0 @@ pub fn roundf(x: f32) -> f32 {

@@ -17,6 +17,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */

use core::f64::consts::FRAC_PI_2;
use super::{k_cosf, k_sinf, rem_pio2f};
use core::f64::consts::FRAC_PI_2;
/* Small multiples of pi/2 rounded to double precision. */

@@ -43,7 +43,3 @@ const S1_PIO2: f64 = 1. * FRAC_PI_2; /* 0x3FF921FB, 0x54442D18 */

/* raise inexact if x!=0 and underflow if subnormal */
force_eval!(if ix < 0x00800000 {
x / x1p120
} else {
x + x1p120
});
force_eval!(if ix < 0x00800000 { x / x1p120 } else { x + x1p120 });
return x;

@@ -63,7 +59,3 @@ }

}
return k_sinf(if sign {
-(x64 + S2_PIO2)
} else {
-(x64 - S2_PIO2)
});
return k_sinf(if sign { -(x64 + S2_PIO2) } else { -(x64 - S2_PIO2) });
}

@@ -70,0 +62,0 @@ if ix <= 0x40e231d5 {

@@ -1,3 +0,2 @@

use super::expm1f;
use super::k_expo2f;
use super::{expm1f, k_expo2f};

@@ -4,0 +3,0 @@ #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -245,5 +245,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_sqrt.c */

mod tests {
use super::*;
use core::f64::*;
use super::*;
#[test]

@@ -250,0 +251,0 @@ fn sanity_check() {

@@ -135,5 +135,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_sqrtf.c */

mod tests {
use super::*;
use core::f32::*;
use super::*;
#[test]

@@ -158,8 +159,3 @@ fn sanity_check() {

fn conformance_tests() {
let values = [
3.14159265359f32,
10000.0f32,
f32::from_bits(0x0000000f),
INFINITY,
];
let values = [3.14159265359f32, 10000.0f32, f32::from_bits(0x0000000f), INFINITY];
let results = [1071833029u32, 1120403456u32, 456082799u32, 2139095040u32];

@@ -166,0 +162,0 @@

@@ -52,7 +52,3 @@ // origin: FreeBSD /usr/src/lib/msun/src/s_tan.c */

/* raise inexact if x!=0 and underflow if subnormal */
force_eval!(if ix < 0x00100000 {
x / x1p120 as f64
} else {
x + x1p120 as f64
});
force_eval!(if ix < 0x00100000 { x / x1p120 as f64 } else { x + x1p120 as f64 });
return x;

@@ -59,0 +55,0 @@ }

@@ -17,6 +17,6 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_tanf.c */

use core::f64::consts::FRAC_PI_2;
use super::{k_tanf, rem_pio2f};
use core::f64::consts::FRAC_PI_2;
/* Small multiples of pi/2 rounded to double precision. */

@@ -43,7 +43,3 @@ const T1_PIO2: f64 = 1. * FRAC_PI_2; /* 0x3FF921FB, 0x54442D18 */

/* raise inexact if x!=0 and underflow if subnormal */
force_eval!(if ix < 0x00800000 {
x / x1p120
} else {
x + x1p120
});
force_eval!(if ix < 0x00800000 { x / x1p120 } else { x + x1p120 });
return x;

@@ -50,0 +46,0 @@ }

@@ -48,7 +48,3 @@ use super::expm1;

if sign {
-t
} else {
t
}
if sign { -t } else { t }
}

@@ -34,7 +34,3 @@ use super::expm1f;

};
if sign {
-tt
} else {
tt
}
if sign { -tt } else { tt }
}

Sorry, the diff of this file is not supported yet