1 // 2 // Copyright (c) 2017 The Khronos Group Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 #ifndef REFERENCE_MATH_H 17 #define REFERENCE_MATH_H 18 19 #if defined(__APPLE__) 20 #include <OpenCL/opencl.h> 21 #else 22 #include <CL/cl.h> 23 #endif 24 25 // -- for testing float -- 26 double reference_sinh(double x); 27 double reference_sqrt(double x); 28 double reference_tanh(double x); 29 double reference_acos(double); 30 double reference_asin(double); 31 double reference_atan(double); 32 double reference_atan2(double, double); 33 double reference_ceil(double); 34 double reference_cosh(double); 35 double reference_exp(double); 36 double reference_fabs(double); 37 double reference_acospi(double); 38 double reference_asinpi(double); 39 double reference_atanpi(double); 40 double reference_atan2pi(double, double); 41 double reference_cospi(double); 42 double reference_divide(double, double); 43 double reference_fract(double, double*); 44 float reference_fma(float, float, float, int); 45 double reference_mad(double, double, double); 46 double reference_nextafter(double, double); 47 double reference_recip(double); 48 double reference_rootn(double, int); 49 double reference_rsqrt(double); 50 double reference_sincos(double, double*); 51 double reference_sinpi(double); 52 double reference_tanpi(double); 53 double reference_pow(double x, double y); 54 double reference_pown(double, int); 55 double reference_powr(double, double); 56 double reference_cos(double); 57 double reference_sin(double); 58 double reference_tan(double); 59 double reference_log(double); 60 double reference_log10(double); 61 double reference_modf(double, double* n); 62 63 double reference_fdim(double, double); 64 double reference_add(double, double); 65 double reference_subtract(double, double); 66 double reference_divide(double, double); 67 double reference_multiply(double, double); 68 double reference_remquo(double, double, int*); 69 double reference_lgamma_r(double, int*); 70 71 int reference_isequal(double, double); 72 int reference_isfinite(double); 73 int reference_isgreater(double, double); 74 int reference_isgreaterequal(double, double); 75 int reference_isinf(double); 76 int reference_isless(double, double); 77 int reference_islessequal(double, double); 78 int reference_islessgreater(double, double); 79 int reference_isnan(double); 80 int reference_isnormal(double); 81 int reference_isnotequal(double, double); 82 int reference_isordered(double, double); 83 int reference_isunordered(double, double); 84 int reference_signbit(float); 85 86 double reference_acosh(double x); 87 double reference_asinh(double x); 88 double reference_atanh(double x); 89 double reference_cbrt(double x); 90 float reference_copysign(float x, float y); 91 double reference_copysignd(double x, double y); 92 double reference_exp10(double); 93 double reference_exp2(double x); 94 double reference_expm1(double x); 95 double reference_fmax(double x, double y); 96 double reference_fmin(double x, double y); 97 double reference_hypot(double x, double y); 98 double reference_lgamma(double x); 99 int reference_ilogb(double); 100 double reference_log2(double x); 101 double reference_log1p(double x); 102 double reference_logb(double x); 103 double reference_maxmag(double x, double y); 104 double reference_minmag(double x, double y); 105 double reference_nan(cl_uint x); 106 double reference_reciprocal(double x); 107 double reference_remainder(double x, double y); 108 double reference_rint(double x); 109 double reference_round(double x); 110 double reference_trunc(double x); 111 double reference_floor(double x); 112 double reference_fmod(double x, double y); 113 double reference_frexp(double x, int* n); 114 double reference_ldexp(double x, int n); 115 116 double reference_assignment(double x); 117 int reference_not(double x); 118 // -- for testing fast-relaxed 119 120 double reference_relaxed_acos(double); 121 double reference_relaxed_asin(double); 122 double reference_relaxed_atan(double); 123 double reference_relaxed_mad(double, double, double); 124 double reference_relaxed_divide(double x, double y); 125 double reference_relaxed_sin(double x); 126 double reference_relaxed_sinpi(double x); 127 double reference_relaxed_cos(double x); 128 double reference_relaxed_cospi(double x); 129 double reference_relaxed_sincos(double x, double* y); 130 double reference_relaxed_tan(double x); 131 double reference_relaxed_exp(double x); 132 double reference_relaxed_exp2(double x); 133 double reference_relaxed_exp10(double x); 134 double reference_relaxed_log(double x); 135 double reference_relaxed_log2(double x); 136 double reference_relaxed_log10(double x); 137 double reference_relaxed_pow(double x, double y); 138 double reference_relaxed_reciprocal(double x); 139 140 // -- for testing double -- 141 142 long double reference_sinhl(long double x); 143 long double reference_sqrtl(long double x); 144 long double reference_tanhl(long double x); 145 long double reference_acosl(long double); 146 long double reference_asinl(long double); 147 long double reference_atanl(long double); 148 long double reference_atan2l(long double, long double); 149 long double reference_ceill(long double); 150 long double reference_coshl(long double); 151 long double reference_expl(long double); 152 long double reference_fabsl(long double); 153 long double reference_acospil(long double); 154 long double reference_asinpil(long double); 155 long double reference_atanpil(long double); 156 long double reference_atan2pil(long double, long double); 157 long double reference_cospil(long double); 158 long double reference_dividel(long double, long double); 159 long double reference_fractl(long double, long double*); 160 long double reference_fmal(long double, long double, long double); 161 long double reference_madl(long double, long double, long double); 162 long double reference_nextafterl(long double, long double); 163 long double reference_recipl(long double); 164 long double reference_rootnl(long double, int); 165 long double reference_rsqrtl(long double); 166 long double reference_sincosl(long double, long double*); 167 long double reference_sinpil(long double); 168 long double reference_tanpil(long double); 169 long double reference_powl(long double x, long double y); 170 long double reference_pownl(long double, int); 171 long double reference_powrl(long double, long double); 172 long double reference_cosl(long double); 173 long double reference_sinl(long double); 174 long double reference_tanl(long double); 175 long double reference_logl(long double); 176 long double reference_log10l(long double); 177 long double reference_modfl(long double, long double* n); 178 179 180 long double reference_fdiml(long double, long double); 181 long double reference_addl(long double, long double); 182 long double reference_subtractl(long double, long double); 183 long double reference_dividel(long double, long double); 184 long double reference_multiplyl(long double, long double); 185 long double reference_remquol(long double, long double, int*); 186 long double reference_lgamma_rl(long double, int*); 187 188 189 int reference_isequall(long double, long double); 190 int reference_isfinitel(long double); 191 int reference_isgreaterl(long double, long double); 192 int reference_isgreaterequall(long double, long double); 193 int reference_isinfl(long double); 194 int reference_islessl(long double, long double); 195 int reference_islessequall(long double, long double); 196 int reference_islessgreaterl(long double, long double); 197 int reference_isnanl(long double); 198 int reference_isnormall(long double); 199 int reference_isnotequall(long double, long double); 200 int reference_isorderedl(long double, long double); 201 int reference_isunorderedl(long double, long double); 202 int reference_signbitl(long double); 203 204 long double reference_acoshl(long double x); 205 long double reference_asinhl(long double x); 206 long double reference_atanhl(long double x); 207 long double reference_cbrtl(long double x); 208 long double reference_copysignl(long double x, long double y); 209 long double reference_exp10l(long double); 210 long double reference_exp2l(long double x); 211 long double reference_expm1l(long double x); 212 long double reference_fmaxl(long double x, long double y); 213 long double reference_fminl(long double x, long double y); 214 long double reference_hypotl(long double x, long double y); 215 long double reference_lgammal(long double x); 216 int reference_ilogbl(long double); 217 long double reference_log2l(long double x); 218 long double reference_log1pl(long double x); 219 long double reference_logbl(long double x); 220 long double reference_maxmagl(long double x, long double y); 221 long double reference_minmagl(long double x, long double y); 222 long double reference_nanl(cl_ulong x); 223 long double reference_reciprocall(long double x); 224 long double reference_remainderl(long double x, long double y); 225 long double reference_rintl(long double x); 226 long double reference_roundl(long double x); 227 long double reference_truncl(long double x); 228 long double reference_floorl(long double x); 229 long double reference_fmodl(long double x, long double y); 230 long double reference_frexpl(long double x, int* n); 231 long double reference_ldexpl(long double x, int n); 232 233 long double reference_assignmentl(long double x); 234 int reference_notl(long double x); 235 236 #endif 237