diff --git a/Cargo.toml b/Cargo.toml index 772e825d..28b396d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,21 @@ autotests = true autobenches = true [package.metadata.docs.rs] -features = ["usize", "u32", "u64", "isize", "i32", "i64", "bigint", "biguint", "rational", "rational32", "rational64", "bigrational", "use_serde"] +features = [ + "usize", + "u32", + "u64", + "isize", + "i32", + "i64", + "bigint", + "biguint", + "rational", + "rational32", + "rational64", + "bigrational", + "use_serde", +] [package.metadata] msrv = "1.43.0" @@ -26,23 +40,23 @@ msrv = "1.43.0" maintenance = { status = "actively-developed" } [workspace] -members = [ - "tests/feature_check", - "uom-macros", - "tests/edition_check", -] +members = ["tests/feature_check", "uom-macros", "tests/edition_check"] [dependencies] num-traits = { version = "0.2", default-features = false } num-rational = { version = "0.4", optional = true, default-features = false } -num-bigint = { version = "0.4", optional = true, default-features = false, features = ["std"] } -num-complex = { version = "0.4", optional = true, default-features = false, features = ["std"] } +num-bigint = { version = "0.4", optional = true, default-features = false, features = [ + "std", +] } +num-complex = { version = "0.4", optional = true, default-features = false, features = [ + "std", +] } serde = { version = "1.0", optional = true, default-features = false } typenum = "1.13" [dev-dependencies] approx = "0.5" -libm = "0.2" +libm = { git = "https://github.com/moritz-meier/libm.git", branch = "feature/add-generic-helper" } quickcheck = "1.0" serde_json = "1.0" static_assertions = "1.1" @@ -87,7 +101,7 @@ rational-support = ["num-rational"] bigint-support = ["num-bigint", "num-rational/num-bigint-std"] complex-support = ["num-complex"] # enable sin/cos for no_std builds, via libm -libm = [ "num-traits/libm" ] +libm = ["num-traits/libm"] [[example]] name = "base" diff --git a/src/si/angle.rs b/src/si/angle.rs index adf150e2..ed337995 100644 --- a/src/si/angle.rs +++ b/src/si/angle.rs @@ -217,7 +217,7 @@ mod tests { #[allow(trivial_casts)] fn atan2(y: V, x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::atan2f(y, x) + libm::Libm::::atan2(y, x) } else { y.atan2(x) }; diff --git a/src/si/ratio.rs b/src/si/ratio.rs index f4305179..25f4ef35 100644 --- a/src/si/ratio.rs +++ b/src/si/ratio.rs @@ -233,7 +233,7 @@ mod tests { quickcheck! { fn acos(x: V) -> bool { let desired_value = if cfg!(feature = "libm") { - libm::acosf(x) + libm::Libm::::acos(x) } else { x.acos() }; @@ -242,7 +242,7 @@ mod tests { fn acosh(x: V) -> bool { let desired_value = if cfg!(feature = "libm") { - libm::acoshf(x) + libm::Libm::::acosh(x) } else { x.acosh() }; @@ -251,7 +251,7 @@ mod tests { fn asin(x: V) -> bool { let desired_value = if cfg!(feature = "libm") { - libm::asinf(x) + libm::Libm::::asin(x) } else { x.asin() }; @@ -260,7 +260,7 @@ mod tests { fn asinh(x: V) -> bool { let desired_value = if cfg!(feature = "libm") { - libm::asinhf(x) + libm::Libm::::asinh(x) } else { x.asinh() }; @@ -269,7 +269,7 @@ mod tests { fn atan(x: V) -> bool { let desired_value = if cfg!(feature = "libm") { - libm::atanf(x) + libm::Libm::::atan(x) } else { x.atan() }; @@ -278,7 +278,7 @@ mod tests { fn atanh(x: V) -> bool { let desired_value = if cfg!(feature = "libm") { - libm::atanhf(x) + libm::Libm::::atanh(x) } else { x.atanh() }; @@ -287,7 +287,7 @@ mod tests { fn exp(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::expf(x) + libm::Libm::::exp(x) } else { x.exp() }; @@ -296,7 +296,7 @@ mod tests { fn exp2(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::exp2f(x) + libm::Libm::::exp2(x) } else { x.exp2() }; @@ -305,7 +305,7 @@ mod tests { fn ln(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::logf(x) + libm::Libm::::log(x) } else { x.ln() }; @@ -314,7 +314,7 @@ mod tests { fn log(x: V, y: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::logf(x) / libm::logf(y) + libm::Libm::::log(x) / libm::Libm::::log(y) } else { x.log(y) }; @@ -323,7 +323,7 @@ mod tests { fn log2(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::log2f(x) + libm::Libm::::log2(x) } else { x.log2() }; @@ -332,7 +332,7 @@ mod tests { fn log10(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::log10f(x) + libm::Libm::::log10(x) } else { x.log10() }; @@ -341,7 +341,7 @@ mod tests { fn exp_m1(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::expm1f(x) + libm::Libm::::expm1(x) } else { x.exp_m1() }; @@ -350,7 +350,7 @@ mod tests { fn ln_1p(x: V) -> bool { let desired_value = if cfg!(feature = "libm"){ - libm::log1pf(x) + libm::Libm::::log1p(x) } else { x.ln_1p() }; diff --git a/src/tests/quantity.rs b/src/tests/quantity.rs index 4e8190a3..d426b494 100644 --- a/src/tests/quantity.rs +++ b/src/tests/quantity.rs @@ -473,7 +473,7 @@ mod float { #[allow(trivial_casts)] fn hypot_same(l: V, r: V) -> bool { let desired_value = if cfg!(feature="libm") && ! cfg!(feature="std") { - libm::hypotf(l, r) + libm::Libm::::hypot(l, r) } else { l.hypot(r) }; diff --git a/src/tests/system.rs b/src/tests/system.rs index 1e078642..499d5afb 100644 --- a/src/tests/system.rs +++ b/src/tests/system.rs @@ -302,7 +302,7 @@ mod float { #[allow(trivial_casts)] fn hypot(l: A, r: A) -> bool { let desired_value = if cfg!(feature="libm"){ - libm::hypotf(*l, *r) + libm::Libm::::hypot(*l, *r) } else { l.hypot(*r) };