-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshim.c
104 lines (84 loc) · 1.54 KB
/
shim.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <math.h>
#include "math_c99.h"
#ifdef __cplusplus
extern "C" {
#endif
double d_mod(const double *x, const double *y)
{
return fmod(*x, *y);
}
void pow_ci(float_complex *r, const float_complex *z, const int *i)
{
const double_complex s = cpow(
cmplx(crealf(*z), cimagf(*z)),
cmplx((double)*i, 0.)
);
*r = cmplxf(creal(s), cimag(s));
}
double pow_dd(const double *x, const double *y)
{
return pow(*x, *y);
}
double pow_di(const double *x, const int *i)
{
return pow(*x, (double)*i);
}
int pow_ii(const int *i, const int *j)
{
return (int)pow((double)*i, (double)*j);
}
double pow_ri(const float *x, const int *i)
{
return pow((double)*x, (double)*i);
}
void r_cnjg(float_complex *r, const float_complex *z)
{
*r = conjf(*z);
}
double r_imag(const float_complex *z)
{
return cimagf(*z);
}
double r_int(const float *x)
{
return truncf(*x);
}
double r_lg10(const float *x)
{
return log10f(*x);
}
double r_mod(const float *x, const float *y)
{
return fmodf(*x, *y);
}
double r_sign(const float *x, const float *y)
{
return copysignf(*x, *y);
}
void c_div(complex *r, const complex *z, const complex *w)
{
*r = cdivf(*z, *w);
}
void c_cos(complex *r, const complex *z)
{
*r = ccosf(*z);
}
void c_exp(complex *r, const complex *z)
{
*r = cexpf(*z);
}
void c_log(complex *r, const complex *z)
{
*r = clogf(*z);
}
void c_sin(complex *r, const complex *z)
{
*r = csinf(*z);
}
void c_sqrt(complex *r, const complex *z)
{
*r = csqrtf(*z);
}
#ifdef __cplusplus
}
#endif