|
1 | 1 | import ctypes::c_int;
|
| 2 | +import ctypes::c_float; |
| 3 | +import ctypes::c_double; |
| 4 | + |
| 5 | +// FIXME scalbn copysign |
2 | 6 |
|
3 | 7 | #[link_name = "m"]
|
4 | 8 | #[abi = "cdecl"]
|
5 |
| -native mod f64 { |
| 9 | +native mod c_double { |
6 | 10 |
|
7 | 11 | // Alpabetically sorted by link_name
|
8 | 12 |
|
9 |
| - pure fn acos(n: f64) -> f64; |
10 |
| - pure fn asin(n: f64) -> f64; |
11 |
| - pure fn atan(n: f64) -> f64; |
12 |
| - pure fn atan2(a: f64, b: f64) -> f64; |
13 |
| - pure fn cbrt(n: f64) -> f64; |
14 |
| - pure fn ceil(n: f64) -> f64; |
15 |
| - pure fn cos(n: f64) -> f64; |
16 |
| - pure fn cosh(n: f64) -> f64; |
17 |
| - pure fn erf(n: f64) -> f64; |
18 |
| - pure fn erfc(n: f64) -> f64; |
19 |
| - pure fn exp(n: f64) -> f64; |
20 |
| - pure fn expm1(n: f64) -> f64; |
21 |
| - pure fn exp2(n: f64) -> f64; |
22 |
| - #[link_name="fabs"] pure fn abs(n: f64) -> f64; |
23 |
| - #[link_name="fdim"] pure fn sub_pos(a: f64, b: f64) -> f64; |
24 |
| - pure fn floor(n: f64) -> f64; |
25 |
| - #[link_name="fma"] pure fn mul_add(a: f64, b: f64, c: f64) -> f64; |
26 |
| - #[link_name="fmax"] pure fn max(a: f64, b: f64) -> f64; |
27 |
| - #[link_name="fmin"] pure fn min(a: f64, b: f64) -> f64; |
28 |
| - pure fn nextafter(x: f64, y: f64) -> f64 |
29 |
| - pure fn fmod(x: f64, y: f64) -> f64; |
30 |
| - pure fn frexp(n: f64, &value: c_int) -> f64; |
31 |
| - pure fn hypot(x: f64, y: f64) -> f64; |
32 |
| - pure fn ldexp(x: f64, n: c_int) -> f64; |
33 |
| - #[link_name="lgamma_r"] pure fn lgamma(n: f64, sign: *c_int) -> f64; |
34 |
| - #[link_name="log"] pure fn ln(n: f64) -> f64; |
35 |
| - pure fn logb(n: f64) -> f64; |
36 |
| - #[link_name="log1p"] pure fn ln1p(n: f64) -> f64; |
37 |
| - pure fn log10(n: f64) -> f64; |
38 |
| - pure fn log2(n: f64) -> f64; |
39 |
| - pure fn ilogb(n: f64) -> c_int; |
40 |
| - pure fn modf(n: f64, iptr: *f64) -> f64; |
41 |
| - pure fn pow(n: f64, e: f64) -> f64; |
42 |
| - #[link_name="remainder"] pure fn rem(a: f64, b: f64) -> f64; |
43 |
| - pure fn rint(n: f64) -> f64; |
44 |
| - pure fn round(n: f64) -> f64; |
45 |
| - pure fn sin(n: f64) -> f64; |
46 |
| - pure fn sinh(n: f64) -> f64; |
47 |
| - pure fn sqrt(n: f64) -> f64; |
48 |
| - pure fn tan(n: f64) -> f64; |
49 |
| - pure fn tanh(n: f64) -> f64; |
50 |
| - pure fn tgamma(n: f64) -> f64; |
51 |
| - pure fn trunc(n: f64) -> f64; |
| 13 | + pure fn acos(n: c_double) -> c_double; |
| 14 | + pure fn asin(n: c_double) -> c_double; |
| 15 | + pure fn atan(n: c_double) -> c_double; |
| 16 | + pure fn atan2(a: c_double, b: c_double) -> c_double; |
| 17 | + pure fn cbrt(n: c_double) -> c_double; |
| 18 | + pure fn ceil(n: c_double) -> c_double; |
| 19 | + pure fn cos(n: c_double) -> c_double; |
| 20 | + pure fn cosh(n: c_double) -> c_double; |
| 21 | + pure fn erf(n: c_double) -> c_double; |
| 22 | + pure fn erfc(n: c_double) -> c_double; |
| 23 | + pure fn exp(n: c_double) -> c_double; |
| 24 | + pure fn expm1(n: c_double) -> c_double; |
| 25 | + pure fn exp2(n: c_double) -> c_double; |
| 26 | + #[link_name="fabs"] pure fn abs(n: c_double) -> c_double; |
| 27 | + #[link_name="fdim"] pure fn sub_pos(a: c_double, b: c_double) -> c_double; |
| 28 | + pure fn floor(n: c_double) -> c_double; |
| 29 | + #[link_name="fma"] pure fn mul_add(a: c_double, b: c_double, c: c_double) -> c_double; |
| 30 | + #[link_name="fmax"] pure fn fmax(a: c_double, b: c_double) -> c_double; |
| 31 | + #[link_name="fmin"] pure fn fmin(a: c_double, b: c_double) -> c_double; |
| 32 | + pure fn nextafter(x: c_double, y: c_double) -> c_double; |
| 33 | + #[link_name="fmod"] pure fn rem(x: c_double, y: c_double) -> c_double; |
| 34 | + pure fn frexp(n: c_double, &value: c_int) -> c_double; |
| 35 | + pure fn hypot(x: c_double, y: c_double) -> c_double; |
| 36 | + pure fn ldexp(x: c_double, n: c_int) -> c_double; |
| 37 | + #[link_name="lgamma_r"] pure fn lgamma(n: c_double, &sign: c_int) -> c_double; |
| 38 | + #[link_name="log"] pure fn ln(n: c_double) -> c_double; |
| 39 | + pure fn logb(n: c_double) -> c_double; |
| 40 | + #[link_name="log1p"] pure fn ln1p(n: c_double) -> c_double; |
| 41 | + pure fn log10(n: c_double) -> c_double; |
| 42 | + pure fn log2(n: c_double) -> c_double; |
| 43 | + pure fn ilogb(n: c_double) -> c_int; |
| 44 | + pure fn modf(n: c_double, &iptr: c_double) -> c_double; |
| 45 | + pure fn pow(n: c_double, e: c_double) -> c_double; |
| 46 | + pure fn rint(n: c_double) -> c_double; |
| 47 | + pure fn round(n: c_double) -> c_double; |
| 48 | + pure fn sin(n: c_double) -> c_double; |
| 49 | + pure fn sinh(n: c_double) -> c_double; |
| 50 | + pure fn sqrt(n: c_double) -> c_double; |
| 51 | + pure fn tan(n: c_double) -> c_double; |
| 52 | + pure fn tanh(n: c_double) -> c_double; |
| 53 | + pure fn tgamma(n: c_double) -> c_double; |
| 54 | + pure fn trunc(n: c_double) -> c_double; |
52 | 55 | }
|
53 | 56 |
|
54 | 57 | #[link_name = "m"]
|
55 | 58 | #[abi = "cdecl"]
|
56 |
| -native mod f32 { |
| 59 | +native mod c_float { |
57 | 60 |
|
58 | 61 | // Alpabetically sorted by link_name
|
59 | 62 |
|
60 |
| - #[link_name="acosf"] pure fn acos(n: f32) -> f32; |
61 |
| - #[link_name="asinf"] pure fn asin(n: f32) -> f32; |
62 |
| - #[link_name="atanf"] pure fn atan(n: f32) -> f32; |
63 |
| - #[link_name="atan2f"] pure fn atan2(a: f32, b: f32) -> f32; |
64 |
| - #[link_name="cbrtf"] pure fn cbrt(n: f32) -> f32; |
65 |
| - #[link_name="ceilf"] pure fn ceil(n: f32) -> f32; |
66 |
| - #[link_name="cosf"] pure fn cos(n: f32) -> f32; |
67 |
| - #[link_name="coshf"] pure fn cosh(n: f32) -> f32; |
68 |
| - #[link_name="erff"] pure fn erf(n: f32) -> f32; |
69 |
| - #[link_name="erfcf"] pure fn erfc(n: f32) -> f32; |
70 |
| - #[link_name="expf"] pure fn exp(n: f32) -> f32; |
71 |
| - #[link_name="expm1f"]pure fn expm1(n: f32) -> f32; |
72 |
| - #[link_name="exp2f"] pure fn exp2(n: f32) -> f32; |
73 |
| - #[link_name="fabsf"] pure fn abs(n: f32) -> f32; |
74 |
| - #[link_name="fdimf"] pure fn sub_pos(a: f32, b: f32) -> f32; |
75 |
| - #[link_name="floorf"] pure fn floor(n: f32) -> f32; |
76 |
| - #[link_name="frexpf"] pure fn frexp(n: f64, &value: c_int) -> f32; |
77 |
| - #[link_name="fmaf"] pure fn mul_add(a: f32, b: f32, c: f32) -> f32; |
78 |
| - #[link_name="fmaxf"] pure fn max(a: f32, b: f32) -> f32; |
79 |
| - #[link_name="fminf"] pure fn min(a: f32, b: f32) -> f32; |
80 |
| - #[link_name="nextafterf"] pure fn nextafter(x: f32, y: f32) -> f32 |
81 |
| - #[link_name="fmodf"] pure fn fmod(x: f32, y: f32) -> f32; |
82 |
| - #[link_name="hypotf"] pure fn hypot(x: f32, y: f32) -> f32; |
83 |
| - #[link_name="ldexpf"] pure fn ldexp(x: f32, n: c_int) -> f32; |
84 |
| - #[link_name="lgammaf_r"] pure fn lgamma(n: f32, sign: *c_int) -> f32; |
85 |
| - #[link_name="logf"] pure fn ln(n: f32) -> f32; |
86 |
| - #[link_name="logbf"] pure fn logb(n: f32) -> f32; |
87 |
| - #[link_name="log1p"] pure fn ln1p(n: f64) -> f64; |
88 |
| - #[link_name="log2f"] pure fn log2(n: f32) -> f32; |
89 |
| - #[link_name="log10f"] pure fn log10(n: f32) -> f32; |
90 |
| - #[link_name="ilogbf"] pure fn ilogb(n: f32) -> c_int; |
91 |
| - #[link_name="modff"] pure fn modf(n: f32, iptr: *f32) -> f32; |
92 |
| - #[link_name="powf"] pure fn pow(n: f32, e: f32) -> f32; |
93 |
| - #[link_name="remainderf"] pure fn rem(a: f32, b: f32) -> f32; |
94 |
| - #[link_name="rintf"] pure fn rint(n: f32) -> f32; |
95 |
| - #[link_name="roundf"] pure fn round(n: f32) -> f32; |
96 |
| - #[link_name="sinf"] pure fn sin(n: f32) -> f32; |
97 |
| - #[link_name="sinhf"] pure fn sinh(n: f32) -> f32; |
98 |
| - #[link_name="sqrtf"] pure fn sqrt(n: f32) -> f32; |
99 |
| - #[link_name="tanf"] pure fn tan(n: f32) -> f32; |
100 |
| - #[link_name="tanhf"] pure fn tanh(n: f32) -> f32; |
101 |
| - #[link_name="tgammaf"] pure fn tgamma(n: f32) -> f32; |
102 |
| - #[link_name="truncf"] pure fn trunc(n: f32) -> f32; |
| 63 | + #[link_name="acosf"] pure fn acos(n: c_float) -> c_float; |
| 64 | + #[link_name="asinf"] pure fn asin(n: c_float) -> c_float; |
| 65 | + #[link_name="atanf"] pure fn atan(n: c_float) -> c_float; |
| 66 | + #[link_name="atan2f"] pure fn atan2(a: c_float, b: c_float) -> c_float; |
| 67 | + #[link_name="cbrtf"] pure fn cbrt(n: c_float) -> c_float; |
| 68 | + #[link_name="ceilf"] pure fn ceil(n: c_float) -> c_float; |
| 69 | + #[link_name="cosf"] pure fn cos(n: c_float) -> c_float; |
| 70 | + #[link_name="coshf"] pure fn cosh(n: c_float) -> c_float; |
| 71 | + #[link_name="erff"] pure fn erf(n: c_float) -> c_float; |
| 72 | + #[link_name="erfcf"] pure fn erfc(n: c_float) -> c_float; |
| 73 | + #[link_name="expf"] pure fn exp(n: c_float) -> c_float; |
| 74 | + #[link_name="expm1f"]pure fn expm1(n: c_float) -> c_float; |
| 75 | + #[link_name="exp2f"] pure fn exp2(n: c_float) -> c_float; |
| 76 | + #[link_name="fabsf"] pure fn abs(n: c_float) -> c_float; |
| 77 | + #[link_name="fdimf"] pure fn sub_pos(a: c_float, b: c_float) -> c_float; |
| 78 | + #[link_name="floorf"] pure fn floor(n: c_float) -> c_float; |
| 79 | + #[link_name="frexpf"] pure fn frexp(n: c_double, &value: c_int) -> c_float; |
| 80 | + #[link_name="fmaf"] pure fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float; |
| 81 | + #[link_name="fmaxf"] pure fn fmax(a: c_float, b: c_float) -> c_float; |
| 82 | + #[link_name="fminf"] pure fn fmin(a: c_float, b: c_float) -> c_float; |
| 83 | + #[link_name="nextafterf"] pure fn nextafter(x: c_float, y: c_float) -> c_float; |
| 84 | + #[link_name="fmodf"] pure fn rem(x: c_float, y: c_float) -> c_float; |
| 85 | + #[link_name="hypotf"] pure fn hypot(x: c_float, y: c_float) -> c_float; |
| 86 | + #[link_name="ldexpf"] pure fn ldexp(x: c_float, n: c_int) -> c_float; |
| 87 | + #[link_name="lgammaf_r"] pure fn lgamma(n: c_float, &sign: c_int) -> c_float; |
| 88 | + #[link_name="logf"] pure fn ln(n: c_float) -> c_float; |
| 89 | + #[link_name="logbf"] pure fn logb(n: c_float) -> c_float; |
| 90 | + #[link_name="log1p"] pure fn ln1p(n: c_double) -> c_double; |
| 91 | + #[link_name="log2f"] pure fn log2(n: c_float) -> c_float; |
| 92 | + #[link_name="log10f"] pure fn log10(n: c_float) -> c_float; |
| 93 | + #[link_name="ilogbf"] pure fn ilogb(n: c_float) -> c_int; |
| 94 | + #[link_name="modff"] pure fn modf(n: c_float, &iptr: c_float) -> c_float; |
| 95 | + #[link_name="powf"] pure fn pow(n: c_float, e: c_float) -> c_float; |
| 96 | + #[link_name="rintf"] pure fn rint(n: c_float) -> c_float; |
| 97 | + #[link_name="roundf"] pure fn round(n: c_float) -> c_float; |
| 98 | + #[link_name="sinf"] pure fn sin(n: c_float) -> c_float; |
| 99 | + #[link_name="sinhf"] pure fn sinh(n: c_float) -> c_float; |
| 100 | + #[link_name="sqrtf"] pure fn sqrt(n: c_float) -> c_float; |
| 101 | + #[link_name="tanf"] pure fn tan(n: c_float) -> c_float; |
| 102 | + #[link_name="tanhf"] pure fn tanh(n: c_float) -> c_float; |
| 103 | + #[link_name="tgammaf"] pure fn tgamma(n: c_float) -> c_float; |
| 104 | + #[link_name="truncf"] pure fn trunc(n: c_float) -> c_float; |
103 | 105 | }
|
104 | 106 |
|
105 | 107 | #[link_name = "m"]
|
106 | 108 | #[abi = "cdecl"]
|
107 | 109 | native mod bessel {
|
108 |
| - pure fn j0(n: m_float) -> m_float; |
109 |
| - pure fn j1(n: m_float) -> m_float; |
110 |
| - pure fn jn(i: c_int, n: m_float) -> m_float; |
| 110 | + pure fn j0(n: c_double) -> c_double; |
| 111 | + pure fn j1(n: c_double) -> c_double; |
| 112 | + pure fn jn(i: c_int, n: c_double) -> c_double; |
111 | 113 |
|
112 |
| - pure fn y0(n: m_float) -> m_float; |
113 |
| - pure fn y1(n: m_float) -> m_float; |
114 |
| - pure fn yn(i: c_int, n: m_float) -> m_float; |
| 114 | + pure fn y0(n: c_double) -> c_double; |
| 115 | + pure fn y1(n: c_double) -> c_double; |
| 116 | + pure fn yn(i: c_int, n: c_double) -> c_double; |
115 | 117 | }
|
116 | 118 |
|
117 | 119 | //
|
|
0 commit comments