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.10
to
0.2.11
+1
-1
.cargo_vcs_info.json
{
"git": {
"sha1": "5c948cb8f05ac30d3d2bc9e51f6f93a41ce877bd"
"sha1": "cdbf42389e40e15350745cc29e86cd5d93cb2a76"
},
"path_in_vcs": ""
}

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

**/*.rs.bk
**.bk
.#*

@@ -7,3 +7,4 @@ /bin

/target
/tests
Cargo.lock
musl/
**.tar.gz

@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "libm"
version = "0.2.10"
version = "0.2.11"
authors = ["Jorge Aparicio <jorge@japaric.io>"]

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

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

## [0.2.11](https://github.com/rust-lang/libm/compare/libm-v0.2.10...libm-v0.2.11) - 2024-10-28
### Fixed
- fix type of constants in ported sincosf ([#331](https://github.com/rust-lang/libm/pull/331))
### Other
- Disable a unit test that is failing on i586
- Add a procedural macro for expanding all function signatures
- Introduce `musl-math-sys` for bindings to musl math symbols
- Add basic docstrings to some functions ([#337](https://github.com/rust-lang/libm/pull/337))
## [0.2.10](https://github.com/rust-lang/libm/compare/libm-v0.2.9...libm-v0.2.10) - 2024-10-28

@@ -13,0 +26,0 @@

@@ -44,2 +44,6 @@ // origin: FreeBSD /usr/src/lib/msun/src/s_cos.c */

//
/// The cosine of `x` (f64).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -46,0 +50,0 @@ pub fn cos(x: f64) -> f64 {

@@ -27,2 +27,5 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_cosf.c */

/// The cosine of `x` (f32).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -29,0 +32,0 @@ pub fn cosf(x: f32) -> f32 {

@@ -112,2 +112,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_j0.c */

/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64).
pub fn j0(mut x: f64) -> f64 {

@@ -166,2 +167,3 @@ let z: f64;

/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64).
pub fn y0(x: f64) -> f64 {

@@ -168,0 +170,0 @@ let z: f64;

@@ -65,2 +65,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_j0f.c */

/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32).
pub fn j0f(mut x: f32) -> f32 {

@@ -111,2 +112,3 @@ let z: f32;

/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32).
pub fn y0f(x: f32) -> f32 {

@@ -113,0 +115,0 @@ let z: f32;

@@ -116,2 +116,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_j1.c */

/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64).
pub fn j1(x: f64) -> f64 {

@@ -162,2 +163,3 @@ let mut z: f64;

/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64).
pub fn y1(x: f64) -> f64 {

@@ -164,0 +166,0 @@ let z: f64;

@@ -66,2 +66,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_j1f.c */

/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32).
pub fn j1f(x: f32) -> f32 {

@@ -111,2 +112,3 @@ let mut z: f32;

/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32).
pub fn y1f(x: f32) -> f32 {

@@ -113,0 +115,0 @@ let z: f32;

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

/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64).
pub fn jn(n: i32, mut x: f64) -> f64 {

@@ -251,2 +252,3 @@ let mut ix: u32;

/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64).
pub fn yn(n: i32, x: f64) -> f64 {

@@ -253,0 +255,0 @@ let mut ix: u32;

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

/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32).
pub fn jnf(n: i32, mut x: f32) -> f32 {

@@ -195,2 +196,3 @@ let mut ix: u32;

/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32).
pub fn ynf(n: i32, x: f32) -> f32 {

@@ -197,0 +199,0 @@ let mut ix: u32;

@@ -73,2 +73,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_log.c */

/// The natural logarithm of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -75,0 +76,0 @@ pub fn log(mut x: f64) -> f64 {

@@ -34,2 +34,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_log10.c */

/// The base 10 logarithm of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -36,0 +37,0 @@ pub fn log10(mut x: f64) -> f64 {

@@ -28,2 +28,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_log10f.c */

/// The base 10 logarithm of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -30,0 +31,0 @@ pub fn log10f(mut x: f32) -> f32 {

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

/// The natural logarithm of 1+`x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -70,0 +71,0 @@ pub fn log1p(x: f64) -> f64 {

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

/// The natural logarithm of 1+`x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -25,0 +26,0 @@ pub fn log1pf(x: f32) -> f32 {

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

/// The base 2 logarithm of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -34,0 +35,0 @@ pub fn log2(mut x: f64) -> f64 {

@@ -26,2 +26,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_log2f.c */

/// The base 2 logarithm of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -28,0 +29,0 @@ pub fn log2f(mut x: f32) -> f32 {

@@ -24,2 +24,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_logf.c */

/// The natural logarithm of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -26,0 +27,0 @@ pub fn logf(mut x: f32) -> f32 {

@@ -92,2 +92,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_pow.c */

/// Returns `x` to the power of `y` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -94,0 +95,0 @@ pub fn pow(x: f64, y: f64) -> f64 {

@@ -46,2 +46,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_powf.c */

/// Returns `x` to the power of `y` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -48,0 +49,0 @@ pub fn powf(x: f32, y: f32) -> f32 {

@@ -197,2 +197,4 @@ // origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2.c

#[test]
// FIXME(correctness): inaccurate results on i586
#[cfg_attr(all(target_arch = "x86", not(target_feature = "sse")), ignore)]
fn test_near_pi() {

@@ -199,0 +201,0 @@ let arg = 3.141592025756836;

@@ -43,2 +43,6 @@ // origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */

// TRIG(x) returns trig(x) nearly rounded
/// The sine of `x` (f64).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -45,0 +49,0 @@ pub fn sin(x: f64) -> f64 {

@@ -15,2 +15,5 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */

/// Both the sine and cosine of `x` (f64).
///
/// `x` is specified in radians and the return value is (sin(x), cos(x)).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -17,0 +20,0 @@ pub fn sincos(x: f64) -> (f64, f64) {

@@ -20,8 +20,11 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */

/* Small multiples of pi/2 rounded to double precision. */
const PI_2: f32 = 0.5 * 3.1415926535897931160E+00;
const S1PIO2: f32 = 1.0 * PI_2; /* 0x3FF921FB, 0x54442D18 */
const S2PIO2: f32 = 2.0 * PI_2; /* 0x400921FB, 0x54442D18 */
const S3PIO2: f32 = 3.0 * PI_2; /* 0x4012D97C, 0x7F3321D2 */
const S4PIO2: f32 = 4.0 * PI_2; /* 0x401921FB, 0x54442D18 */
const PI_2: f64 = 0.5 * 3.1415926535897931160E+00;
const S1PIO2: f64 = 1.0 * PI_2; /* 0x3FF921FB, 0x54442D18 */
const S2PIO2: f64 = 2.0 * PI_2; /* 0x400921FB, 0x54442D18 */
const S3PIO2: f64 = 3.0 * PI_2; /* 0x4012D97C, 0x7F3321D2 */
const S4PIO2: f64 = 4.0 * PI_2; /* 0x401921FB, 0x54442D18 */
/// Both the sine and cosine of `x` (f32).
///
/// `x` is specified in radians and the return value is (sin(x), cos(x)).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -60,7 +63,7 @@ pub fn sincosf(x: f32) -> (f32, f32) {

if sign {
s = -k_cosf((x + S1PIO2) as f64);
c = k_sinf((x + S1PIO2) as f64);
s = -k_cosf(x as f64 + S1PIO2);
c = k_sinf(x as f64 + S1PIO2);
} else {
s = k_cosf((S1PIO2 - x) as f64);
c = k_sinf((S1PIO2 - x) as f64);
s = k_cosf(S1PIO2 - x as f64);
c = k_sinf(S1PIO2 - x as f64);
}

@@ -71,7 +74,7 @@ }

if sign {
s = -k_sinf((x + S2PIO2) as f64);
c = -k_cosf((x + S2PIO2) as f64);
s = -k_sinf(x as f64 + S2PIO2);
c = -k_cosf(x as f64 + S2PIO2);
} else {
s = -k_sinf((x - S2PIO2) as f64);
c = -k_cosf((x - S2PIO2) as f64);
s = -k_sinf(x as f64 - S2PIO2);
c = -k_cosf(x as f64 - S2PIO2);
}

@@ -88,15 +91,15 @@ }

if sign {
s = k_cosf((x + S3PIO2) as f64);
c = -k_sinf((x + S3PIO2) as f64);
s = k_cosf(x as f64 + S3PIO2);
c = -k_sinf(x as f64 + S3PIO2);
} else {
s = -k_cosf((x - S3PIO2) as f64);
c = k_sinf((x - S3PIO2) as f64);
s = -k_cosf(x as f64 - S3PIO2);
c = k_sinf(x as f64 - S3PIO2);
}
} else {
if sign {
s = k_sinf((x + S4PIO2) as f64);
c = k_cosf((x + S4PIO2) as f64);
s = k_sinf(x as f64 + S4PIO2);
c = k_cosf(x as f64 + S4PIO2);
} else {
s = k_sinf((x - S4PIO2) as f64);
c = k_cosf((x - S4PIO2) as f64);
s = k_sinf(x as f64 - S4PIO2);
c = k_cosf(x as f64 - S4PIO2);
}

@@ -135,12 +138,4 @@ }

use super::sincosf;
use crate::_eqf;
#[test]
fn with_pi() {
let (s, c) = sincosf(core::f32::consts::PI);
_eqf(s.abs(), 0.0).unwrap();
_eqf(c, -1.0).unwrap();
}
#[test]
fn rotational_symmetry() {

@@ -147,0 +142,0 @@ use core::f32::consts::PI;

@@ -27,2 +27,5 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */

/// The sine of `x` (f32).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -29,0 +32,0 @@ pub fn sinf(x: f32) -> f32 {

@@ -7,2 +7,4 @@ use super::{expm1, expo2};

//
/// The hyperbolic sine of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -9,0 +11,0 @@ pub fn sinh(x: f64) -> f64 {

use super::{expm1f, k_expo2f};
/// The hyperbolic sine of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -4,0 +5,0 @@ pub fn sinhf(x: f32) -> f32 {

@@ -81,2 +81,3 @@ /* origin: FreeBSD /usr/src/lib/msun/src/e_sqrt.c */

/// The square root of `x` (f64).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -83,0 +84,0 @@ pub fn sqrt(x: f64) -> f64 {

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

/// The square root of `x` (f32).
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -18,0 +19,0 @@ pub fn sqrtf(x: f32) -> f32 {

@@ -42,2 +42,6 @@ // origin: FreeBSD /usr/src/lib/msun/src/s_tan.c */

// TRIG(x) returns trig(x) nearly rounded
/// The tangent of `x` (f64).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -44,0 +48,0 @@ pub fn tan(x: f64) -> f64 {

@@ -27,2 +27,5 @@ /* origin: FreeBSD /usr/src/lib/msun/src/s_tanf.c */

/// The tangent of `x` (f32).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -29,0 +32,0 @@ pub fn tanf(x: f32) -> f32 {

@@ -7,2 +7,6 @@ use super::expm1;

*/
/// The hyperbolic tangent of `x` (f64).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -9,0 +13,0 @@ pub fn tanh(mut x: f64) -> f64 {

use super::expm1f;
/// The hyperbolic tangent of `x` (f32).
///
/// `x` is specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]

@@ -4,0 +7,0 @@ pub fn tanhf(mut x: f32) -> f32 {

Sorry, the diff of this file is not supported yet