math.rs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #[allow(dead_code)]
  2. #[path = "../libm/src/math/mod.rs"]
  3. mod libm;
  4. macro_rules! no_mangle {
  5. ($(fn $fun:ident($($iid:ident : $ity:ty),+) -> $oty:ty;)+) => {
  6. intrinsics! {
  7. $(
  8. pub extern "C" fn $fun($($iid: $ity),+) -> $oty {
  9. self::libm::$fun($($iid),+)
  10. }
  11. )+
  12. }
  13. }
  14. }
  15. // only for the wasm32-unknown-unknown target
  16. #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
  17. no_mangle! {
  18. fn acos(x: f64) -> f64;
  19. fn asin(x: f64) -> f64;
  20. fn atan(x: f64) -> f64;
  21. fn atan2(x: f64, y: f64) -> f64;
  22. fn cbrt(x: f64) -> f64;
  23. fn cosh(x: f64) -> f64;
  24. fn expm1(x: f64) -> f64;
  25. fn hypot(x: f64, y: f64) -> f64;
  26. fn log1p(x: f64) -> f64;
  27. fn sinh(x: f64) -> f64;
  28. fn tan(x: f64) -> f64;
  29. fn tanh(x: f64) -> f64;
  30. fn cos(x: f64) -> f64;
  31. fn cosf(x: f32) -> f32;
  32. fn exp(x: f64) -> f64;
  33. fn expf(x: f32) -> f32;
  34. fn log2(x: f64) -> f64;
  35. fn log2f(x: f32) -> f32;
  36. fn log10(x: f64) -> f64;
  37. fn log10f(x: f32) -> f32;
  38. fn log(x: f64) -> f64;
  39. fn logf(x: f32) -> f32;
  40. fn round(x: f64) -> f64;
  41. fn roundf(x: f32) -> f32;
  42. fn sin(x: f64) -> f64;
  43. fn sinf(x: f32) -> f32;
  44. fn pow(x: f64, y: f64) -> f64;
  45. fn powf(x: f32, y: f32) -> f32;
  46. fn exp2(x: f64) -> f64;
  47. fn exp2f(x: f32) -> f32;
  48. fn fmod(x: f64, y: f64) -> f64;
  49. fn fmodf(x: f32, y: f32) -> f32;
  50. fn fma(x: f64, y: f64, z: f64) -> f64;
  51. fn fmaf(x: f32, y: f32, z: f32) -> f32;
  52. }
  53. // only for the thumb*-none-eabi* targets
  54. #[cfg(all(target_arch = "arm", target_os = "none"))]
  55. no_mangle! {
  56. // `f64 % f64`
  57. fn fmod(x: f64, y: f64) -> f64;
  58. // `f32 % f32`
  59. fn fmodf(x: f32, y: f32) -> f32;
  60. }