3 use libc::{c_double, c_float};
6 pub fn acos(n: c_double) -> c_double;
7 pub fn asin(n: c_double) -> c_double;
8 pub fn atan(n: c_double) -> c_double;
9 pub fn atan2(a: c_double, b: c_double) -> c_double;
10 pub fn cbrt(n: c_double) -> c_double;
11 pub fn cbrtf(n: c_float) -> c_float;
12 pub fn cosh(n: c_double) -> c_double;
13 pub fn expm1(n: c_double) -> c_double;
14 pub fn expm1f(n: c_float) -> c_float;
15 pub fn fdim(a: c_double, b: c_double) -> c_double;
16 pub fn fdimf(a: c_float, b: c_float) -> c_float;
17 #[cfg_attr(target_env = "msvc", link_name = "_hypot")]
18 pub fn hypot(x: c_double, y: c_double) -> c_double;
19 #[cfg_attr(target_env = "msvc", link_name = "_hypotf")]
20 pub fn hypotf(x: c_float, y: c_float) -> c_float;
21 pub fn log1p(n: c_double) -> c_double;
22 pub fn log1pf(n: c_float) -> c_float;
23 pub fn sinh(n: c_double) -> c_double;
24 pub fn tan(n: c_double) -> c_double;
25 pub fn tanh(n: c_double) -> c_double;
28 pub use self::shims::*;
30 #[cfg(not(all(target_env = "msvc", target_arch = "x86")))]
35 pub fn acosf(n: c_float) -> c_float;
36 pub fn asinf(n: c_float) -> c_float;
37 pub fn atan2f(a: c_float, b: c_float) -> c_float;
38 pub fn atanf(n: c_float) -> c_float;
39 pub fn coshf(n: c_float) -> c_float;
40 pub fn sinhf(n: c_float) -> c_float;
41 pub fn tanf(n: c_float) -> c_float;
42 pub fn tanhf(n: c_float) -> c_float;
46 // On 32-bit x86 MSVC these functions aren't defined, so we just define shims
47 // which promote everything to f64, perform the calculation, and then demote
48 // back to f32. While not precisely correct should be "correct enough" for now.
49 #[cfg(all(target_env = "msvc", target_arch = "x86"))]
54 pub unsafe fn acosf(n: c_float) -> c_float {
55 f64::acos(n as f64) as c_float
59 pub unsafe fn asinf(n: c_float) -> c_float {
60 f64::asin(n as f64) as c_float
64 pub unsafe fn atan2f(n: c_float, b: c_float) -> c_float {
65 f64::atan2(n as f64, b as f64) as c_float
69 pub unsafe fn atanf(n: c_float) -> c_float {
70 f64::atan(n as f64) as c_float
74 pub unsafe fn coshf(n: c_float) -> c_float {
75 f64::cosh(n as f64) as c_float
79 pub unsafe fn sinhf(n: c_float) -> c_float {
80 f64::sinh(n as f64) as c_float
84 pub unsafe fn tanf(n: c_float) -> c_float {
85 f64::tan(n as f64) as c_float
89 pub unsafe fn tanhf(n: c_float) -> c_float {
90 f64::tanh(n as f64) as c_float