~ubuntu-branches/ubuntu/wily/numexpr/wily-proposed

« back to all changes in this revision

Viewing changes to numexpr/msvc_function_stubs.hpp

  • Committer: Package Import Robot
  • Author(s): Antonio Valentino
  • Date: 2013-09-28 09:03:27 UTC
  • mfrom: (7.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130928090327-s69mvg0n2xnz6cn8
New upstream release (fixes a build failure on s390)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef NUMEXPR_MSVC_FUNCTION_STUBS_HPP
 
2
#define NUMEXPR_MSVC_FUNCTION_STUBS_HPP
 
3
 
 
4
/*********************************************************************
 
5
  Numexpr - Fast numerical array expression evaluator for NumPy.
 
6
 
 
7
      License: MIT
 
8
      Author:  See AUTHORS.txt
 
9
 
 
10
  See LICENSE.txt for details about copyright and rights to use.
 
11
**********************************************************************/
 
12
 
 
13
/* Declare stub functions for MSVC.  It turns out that single precision
 
14
   definitions in <math.h> are actually #define'd and are not usable
 
15
   as function pointers :-/ */
 
16
 
 
17
#if _MSC_VER < 1400  // 1310 == MSVC 7.1
 
18
/* Apparently, single precision functions are not included in MSVC 7.1 */
 
19
 
 
20
#define sqrtf(x)    ((float)sqrt((double)(x)))
 
21
#define sinf(x)    ((float)sin((double)(x)))
 
22
#define cosf(x)    ((float)cos((double)(x)))
 
23
#define tanf(x)    ((float)tan((double)(x)))
 
24
#define asinf(x)    ((float)asin((double)(x)))
 
25
#define acosf(x)    ((float)acos((double)(x)))
 
26
#define atanf(x)    ((float)atan((double)(x)))
 
27
#define sinhf(x)    ((float)sinh((double)(x)))
 
28
#define coshf(x)    ((float)cosh((double)(x)))
 
29
#define tanhf(x)    ((float)tanh((double)(x)))
 
30
#define asinhf(x)    ((float)asinh((double)(x)))
 
31
#define acoshf(x)    ((float)acosh((double)(x)))
 
32
#define atanhf(x)    ((float)atanh((double)(x)))
 
33
#define logf(x)    ((float)log((double)(x)))
 
34
#define log1pf(x)    ((float)log1p((double)(x)))
 
35
#define log10f(x)    ((float)log10((double)(x)))
 
36
#define expf(x)    ((float)exp((double)(x)))
 
37
#define expm1f(x)    ((float)expm1((double)(x)))
 
38
#define fabsf(x)    ((float)fabs((double)(x)))
 
39
#define fmodf(x, y)    ((float)fmod((double)(x), (double)(y)))
 
40
#define atan2f(x, y)    ((float)atan2((double)(x), (double)(y)))
 
41
 
 
42
/* The next are directly called from interp_body.cpp */
 
43
#define powf(x, y)    ((float)pow((double)(x), (double)(y)))
 
44
#define floorf(x)    ((float)floor((double)(x)))
 
45
 
 
46
#endif  // _MSC_VER < 1400
 
47
 
 
48
 
 
49
/* Now the actual stubs */
 
50
 
 
51
inline float sqrtf2(float x) {
 
52
    return sqrtf(x);
 
53
}
 
54
 
 
55
inline float sinf2(float x) {
 
56
    return sinf(x);
 
57
}
 
58
 
 
59
inline float cosf2(float x) {
 
60
    return cosf(x);
 
61
}
 
62
 
 
63
inline float tanf2(float x) {
 
64
    return tanf(x);
 
65
}
 
66
 
 
67
inline float asinf2(float x) {
 
68
    return asinf(x);
 
69
}
 
70
 
 
71
inline float acosf2(float x) {
 
72
    return acosf(x);
 
73
}
 
74
 
 
75
inline float atanf2(float x) {
 
76
    return atanf(x);
 
77
}
 
78
 
 
79
inline float sinhf2(float x) {
 
80
    return sinhf(x);
 
81
}
 
82
 
 
83
inline float coshf2(float x) {
 
84
    return coshf(x);
 
85
}
 
86
 
 
87
inline float tanhf2(float x) {
 
88
    return tanhf(x);
 
89
}
 
90
 
 
91
inline float asinhf2(float x) {
 
92
    return asinhf(x);
 
93
}
 
94
 
 
95
inline float acoshf2(float x) {
 
96
    return acoshf(x);
 
97
}
 
98
 
 
99
inline float atanhf2(float x) {
 
100
    return atanhf(x);
 
101
}
 
102
 
 
103
inline float logf2(float x) {
 
104
    return logf(x);
 
105
}
 
106
 
 
107
inline float log1pf2(float x) {
 
108
    return log1pf(x);
 
109
}
 
110
 
 
111
inline float log10f2(float x) {
 
112
    return log10f(x);
 
113
}
 
114
 
 
115
inline float expf2(float x) {
 
116
    return expf(x);
 
117
}
 
118
 
 
119
inline float expm1f2(float x) {
 
120
    return expm1f(x);
 
121
}
 
122
 
 
123
inline float fabsf2(float x) {
 
124
    return fabsf(x);
 
125
}
 
126
 
 
127
inline float fmodf2(float x, float y) {
 
128
    return fmodf(x, y);
 
129
}
 
130
 
 
131
inline float atan2f2(float x, float y) {
 
132
    return atan2f(x, y);
 
133
}
 
134
 
 
135
#endif // NUMEXPR_MSVC_FUNCTION_STUBS_HPP