39template <
typename T,
typename S>
41 -> std::enable_if_t<std::is_floating_point_v<T> &&
42 std::is_floating_point_v<S>,
43 decltype(std::pow(x, y))>
46 if constexpr (std::is_same_v<T, float> && std::is_same_v<S, float>) {
49 else if constexpr (std::is_same_v<T, double> && std::is_same_v<S, double>) {
53 return ::pow(
static_cast<double>(x),
static_cast<double>(y));
57 return std::pow(x, y);
61template <
typename T,
typename S>
63 -> std::enable_if_t<std::is_integral_v<S> && std::is_floating_point_v<T>,
64 decltype(std::pow(x, y))>
67 if constexpr (std::is_same_v<T, float>) {
70 else if constexpr (std::is_same_v<T, double>) {
74 return ::pow(
static_cast<double>(x), y);
78 return std::pow(x, y);
82template <
typename T,
typename S>
84 -> std::enable_if_t<std::is_integral_v<T> && std::is_floating_point_v<S>,
85 decltype(std::pow(x, y))>
88 if constexpr (std::is_same_v<S, float>) {
91 else if constexpr (std::is_same_v<S, double>) {
95 return ::pow(x,
static_cast<double>(y));
99 return std::pow(x, y);
102template <
typename T,
typename S>
104 std::is_integral_v<T> && std::is_integral_v<S>,
double>
110 return std::pow(x, y);
117 return ::powf(base,
exp);
119 return std::pow(base,
exp);
126 return ::powf(base,
exp);
128 return std::pow(base,
exp);
132inline long double powl(
long double base,
long double exp)
139template <
typename T,
typename S>
141 -> std::enable_if_t<std::is_floating_point_v<T> &&
142 std::is_floating_point_v<S>,
143 decltype(std::fmod(x, y))>
146 if constexpr (std::is_same_v<T, float> && std::is_same_v<S, float>) {
147 return ::fmodf(x, y);
149 else if constexpr (std::is_same_v<T, double> && std::is_same_v<S, double>) {
153 return ::fmod(
static_cast<double>(x),
static_cast<double>(y));
157 return std::fmod(x, y);
161template <
typename T,
typename S>
163 std::is_integral_v<S> && std::is_floating_point_v<T>, T>
167 if constexpr (std::is_same_v<T, float>) {
168 return ::fmodf(x, y);
170 else if constexpr (std::is_same_v<T, double>) {
174 return ::fmod(
static_cast<double>(x), y);
178 return std::fmod(x, y);
182template <
typename T,
typename S>
184 std::is_integral_v<T> && std::is_floating_point_v<S>, S>
188 if constexpr (std::is_same_v<S, float>) {
189 return ::fmodf(x, y);
191 else if constexpr (std::is_same_v<S, double>) {
195 return ::fmod(x,
static_cast<double>(y));
199 return std::fmod(x, y);
206 return ::fmodf(x, y);
208 return std::fmod(x, y);
215 return ::fmodf(x, y);
217 return std::fmod(x, y);
221inline long double fmodl(
long double x,
long double y)
232 if constexpr (std::is_same_v<T, float>) {
235 else if constexpr (std::is_same_v<T, double>) {
239 return ::exp(
static_cast<double>(x));
253 return std::exp(arg);
262 return std::exp(arg);
271 return std::exp(arg);
275inline long double expl(
long double arg)
285 if constexpr (std::is_same_v<T, float>) {
288 else if constexpr (std::is_same_v<T, double>) {
292 return ::log(
static_cast<double>(x));
306 return std::log(arg);
315 return std::log(arg);
324 return std::log(arg);
328inline long double logl(
long double arg)
340 if constexpr (std::is_same_v<T, float>) {
343 else if constexpr (std::is_same_v<T, double>) {
347 return ::log10(
static_cast<double>(x));
351 return std::log10(x);
361 return std::log10(arg);
368 return ::log10f(arg);
370 return std::log10(arg);
377 return ::log10f(arg);
379 return std::log10(arg);
383inline long double log10l(
long double arg)
395 if constexpr (std::is_same_v<T, float>) {
398 else if constexpr (std::is_same_v<T, double>) {
402 return ::log2(
static_cast<double>(x));
416 return std::log2(arg);
425 return std::log2(arg);
434 return std::log2(arg);
438inline long double log2l(
long double arg)
449 if constexpr (std::is_same_v<T, float>) {
452 else if constexpr (std::is_same_v<T, double>) {
456 return ::log1p(
static_cast<double>(x));
460 return std::log1p(x);
470 return std::log1p(arg);
477 return ::log1pf(arg);
479 return std::log1p(arg);
486 return ::log1pf(arg);
488 return std::log1p(arg);
492inline long double log1pl(
long double arg)
503 if constexpr (std::is_same_v<T, float>) {
506 else if constexpr (std::is_same_v<T, double>) {
510 return ::sqrt(
static_cast<double>(x));
524 return std::sqrt(arg);
533 return std::sqrt(arg);
542 return std::sqrt(arg);
546inline long double sqrtl(
long double arg)
576 if constexpr (std::is_same_v<T, float>) {
579 else if constexpr (std::is_same_v<T, double>) {
583 return ::sin(
static_cast<double>(x));
601inline long double sinl(
long double arg)
631 if constexpr (std::is_same_v<T, float>) {
634 else if constexpr (std::is_same_v<T, double>) {
638 return ::sinh(
static_cast<double>(x));
656inline long double sinhl(
long double arg)
686 if constexpr (std::is_same_v<T, float>) {
689 else if constexpr (std::is_same_v<T, double>) {
693 return ::cos(
static_cast<double>(x));
711inline long double cosl(
long double arg)
741 if constexpr (std::is_same_v<T, float>) {
744 else if constexpr (std::is_same_v<T, double>) {
748 return ::cosh(
static_cast<double>(x));
766inline long double coshl(
long double arg)
795 if constexpr (std::is_same_v<T, float>) {
798 else if constexpr (std::is_same_v<T, double>) {
802 return ::tan(
static_cast<double>(x));
820inline long double tanl(
long double arg)
849 if constexpr (std::is_same_v<T, float>) {
852 else if constexpr (std::is_same_v<T, double>) {
856 return ::tanh(
static_cast<double>(x));
874inline long double tanhl(
long double arg)
902 if constexpr (std::is_same_v<T, float>) {
905 else if constexpr (std::is_same_v<T, double>) {
909 return ::asin(
static_cast<double>(x));
927inline long double asinl(
long double arg)
939 return std::asinh(x);
948 return std::asinh(x);
956 if constexpr (std::is_same_v<T, float>) {
959 else if constexpr (std::is_same_v<T, double>) {
963 return ::asinh(
static_cast<double>(x));
967 return std::asinh(x);
977 return std::asinh(x);
981inline long double asinhl(
long double arg)
983 return std::asinhl(arg);
1002 return std::acos(x);
1006template <
typename T>
1010 if constexpr (std::is_same_v<T, float>) {
1013 else if constexpr (std::is_same_v<T, double>) {
1017 return ::acos(
static_cast<double>(x));
1021 return std::acos(x);
1025template <
typename T>
1031 return std::acos(x);
1035inline long double acosl(
long double arg)
1047 return std::acosh(x);
1056 return std::acosh(x);
1060template <
typename T>
1064 if constexpr (std::is_same_v<T, float>) {
1067 else if constexpr (std::is_same_v<T, double>) {
1071 return ::acosh(
static_cast<double>(x));
1075 return std::acosh(x);
1079template <
typename T>
1085 return std::acosh(x);
1091 return std::acoshl(arg);
1101 return std::atan(x);
1110 return std::atan(x);
1114template <
typename T>
1118 if constexpr (std::is_same_v<T, float>) {
1121 else if constexpr (std::is_same_v<T, double>) {
1125 return ::atan(
static_cast<double>(x));
1129 return std::atan(x);
1133template <
typename T>
1139 return std::atan(x);
1143inline long double atanl(
long double arg)
1150template <
typename T,
typename S>
1152 -> std::enable_if_t<std::is_floating_point_v<T> &&
1153 std::is_floating_point_v<S>,
1154 decltype(std::atan2(x, y))>
1157 if constexpr (std::is_same_v<T, float> && std::is_same_v<S, float>) {
1158 return ::atan2f(x, y);
1160 else if constexpr (std::is_same_v<T, double> && std::is_same_v<S, double>) {
1161 return ::atan2(x, y);
1164 return ::atan2(
static_cast<double>(x),
static_cast<double>(y));
1168 return std::atan2(x, y);
1172template <
typename T,
typename S>
1174 std::is_integral_v<S> && std::is_floating_point_v<T>, T>
1178 if constexpr (std::is_same_v<T, float>) {
1179 return ::atan2f(x, y);
1181 else if constexpr (std::is_same_v<T, double>) {
1182 return ::atan2(x, y);
1185 return ::atan2(
static_cast<double>(x), y);
1189 return std::atan2(x, y);
1193template <
typename T,
typename S>
1195 std::is_integral_v<T> && std::is_floating_point_v<S>, S>
1199 if constexpr (std::is_same_v<S, float>) {
1200 return ::atan2f(x, y);
1202 else if constexpr (std::is_same_v<S, double>) {
1203 return ::atan2(x, y);
1206 return ::atan2(x,
static_cast<double>(y));
1210 return std::atan2(x, y);
1213template <
typename T,
typename S>
1215 std::is_integral_v<T> && std::is_integral_v<S>,
double>
1219 return ::atan2(x, y);
1221 return std::atan2(x, y);
1228 return ::atan2f(base,
exp);
1230 return std::atan2(base,
exp);
1237 return ::atan2f(base,
exp);
1239 return std::atan2(base,
exp);
1249 return std::atanh(x);
1258 return std::atanh(x);
1262template <
typename T>
1266 if constexpr (std::is_same_v<T, float>) {
1269 else if constexpr (std::is_same_v<T, double>) {
1273 return ::atanh(
static_cast<double>(x));
1277 return std::atanh(x);
1281template <
typename T>
1287 return std::atanh(x);
1304 return std::floor(x);
1313 return std::floor(x);
1317template <
typename T>
1321 if constexpr (std::is_same_v<T, float>) {
1324 else if constexpr (std::is_same_v<T, double>) {
1328 return ::floor(
static_cast<double>(x));
1332 return std::floor(x);
1336template <
typename T>
1342 return std::floor(x);
1358 return std::ceil(x);
1367 return std::ceil(x);
1371template <
typename T>
1375 if constexpr (std::is_same_v<T, float>) {
1378 else if constexpr (std::is_same_v<T, double>) {
1382 return ::ceil(
static_cast<double>(x));
1386 return std::ceil(x);
1390template <
typename T>
1396 return std::ceil(x);
1400inline long double ceill(
long double arg)
1412 return std::trunc(x);
1421 return std::trunc(x);
1425template <
typename T>
1429 if constexpr (std::is_same_v<T, float>) {
1432 else if constexpr (std::is_same_v<T, double>) {
1436 return ::trunc(
static_cast<double>(x));
1440 return std::trunc(x);
1444template <
typename T>
1450 return std::trunc(x);
1456 return std::truncl(arg);
1466 return std::round(x);
1475 return std::round(x);
1479template <
typename T>
1483 if constexpr (std::is_same_v<T, float>) {
1486 else if constexpr (std::is_same_v<T, double>) {
1490 return ::round(
static_cast<double>(x));
1494 return std::round(x);
1498template <
typename T>
1504 return std::round(x);
1510 return std::roundl(arg);
1514template <
typename T>
1515inline std::enable_if_t<std::is_arithmetic_v<T>,
long>
lround(T arg)
1517 return std::lround(arg);
1520inline long lroundf(
float arg) {
return std::lroundf(arg); }
1522inline long lroundl(
long double arg) {
return std::lroundl(arg); }
1524template <
typename T>
1525inline std::enable_if_t<std::is_arithmetic_v<T>,
long long>
llround(T arg)
1527 return std::llround(arg);
1530inline long long llroundf(
float arg) {
return std::llroundf(arg); }
1532inline long long llroundl(
long double arg) {
return std::llroundl(arg); }
1553template <
typename T>
1557 if constexpr (std::is_same_v<T, float>) {
1560 else if constexpr (std::is_same_v<T, double>) {
1564 return ::fabs(
static_cast<double>(x));
1568 return std::fabs(x);
1572template <
typename T>
1578 return std::fabs(x);
1582template <
typename T>
1586 if constexpr (std::is_same_v<T, float>) {
1589 else if constexpr (std::is_same_v<T, double>) {
1593 return ::fabs(
static_cast<double>(x));
1601template <
typename T>
1611inline long double fabs(
long double arg) {
return std::abs(arg); }
1613template <std::
integral T>
1616 return fabs(x) <= std::numeric_limits<T>::epsilon();
1620template <
typename T>
1624 return ::isnan(arg);
1626 return std::isnan(arg);
long double atanl(long double arg)
ADf< T, DIM > abs(const ADf< T, DIM > &a)
ADf< T, DIM > ceil(const ADf< T, DIM > &a)
ADf< T, DIM > floor(const ADf< T, DIM > &a)
long double fmodl(long double x, long double y)
ADf< T, DIM > tan(const ADf< T, DIM > &a)
ADf< T, DIM > fmod(const ADf< T, DIM > &a, const ADf< T, DIM > &b)
any_platform float atan2f(float base, float exp)
long double asinl(long double arg)
long double sinl(long double arg)
ADf< T, DIM > atan2(const T &y, const ADf< T, DIM > &x)
long double tanhl(long double arg)
ADf< float, DIM > llroundf(const ADf< float, DIM > &a)
ADf< T, DIM > asinh(const ADf< T, DIM > &a)
any_platform float asinf(float x)
ADf< long double, DIM > log1pl(const ADf< long double, DIM > &a)
any_platform float sinhf(float x)
ADf< T, DIM > lround(const ADf< T, DIM > &a)
any_platform std::enable_if_t< std::is_floating_point_v< T >, T > trunc(T x)
long double truncl(long double arg)
any_platform float sqrtf(float arg)
ADf< float, DIM > log10f(const ADf< float, DIM > &a)
ADf< T, DIM > log(const ADf< T, DIM > &a)
any_platform float acoshf(float x)
ADf< long double, DIM > expl(const ADf< long double, DIM > &a)
ADf< float, DIM > logf(const ADf< float, DIM > &a)
ADf< long double, DIM > log2l(const ADf< long double, DIM > &a)
any_platform float tanhf(float x)
long double asinhl(long double arg)
any_platform float atanf(float x)
any_platform bool isnan(T arg)
long double tanl(long double arg)
long double sqrtl(long double arg)
ADf< float, DIM > roundf(const ADf< float, DIM > &a)
ADf< T, DIM > round(const ADf< T, DIM > &a)
any_platform bool closeToZero(T x)
ADf< float, DIM > log2f(const ADf< float, DIM > &a)
ADf< long double, DIM > log10l(const ADf< long double, DIM > &a)
ADf< T, DIM > llround(const ADf< T, DIM > &a)
any_platform float truncf(float x)
ADf< float, DIM > floorf(const ADf< float, DIM > &a)
ADf< T, DIM > sin(const ADf< T, DIM > &a)
ADf< float, DIM > expf(const ADf< float, DIM > &a)
ADf< T, DIM > acosh(const ADf< T, DIM > &a)
long double acosl(long double arg)
ADf< long double, DIM > floorl(const ADf< long double, DIM > &a)
ADf< float, DIM > fabsf(const ADf< float, DIM > &a)
long double powl(long double base, long double exp)
any_platform float fmodf(float x, float y)
Expr pow(Expr base, Expr exp)
any_platform float asinhf(float x)
long double acoshl(long double arg)
ADf< T, DIM > asin(const ADf< T, DIM > &a)
ADf< T, DIM > log1p(const ADf< T, DIM > &a)
any_platform float cosf(float x)
any_platform float acosf(float x)
long double sinhl(long double arg)
any_platform float tanf(float x)
ADf< float, DIM > lroundf(const ADf< float, DIM > &a)
ADf< T, DIM > cosh(const ADf< T, DIM > &a)
ADf< T, DIM > sinh(const ADf< T, DIM > &a)
long double atanhl(long double arg)
ADf< long double, DIM > lroundl(const ADf< long double, DIM > &a)
ADf< long double, DIM > roundl(const ADf< long double, DIM > &a)
ADf< T, DIM > acos(const ADf< T, DIM > &a)
ADf< long double, DIM > llroundl(const ADf< long double, DIM > &a)
any_platform float powf(float base, float exp)
any_platform float atanhf(float x)
long double cosl(long double arg)
any_platform float sinf(float x)
ADf< long double, DIM > ceill(const ADf< long double, DIM > &a)
ADf< T, DIM > tanh(const ADf< T, DIM > &a)
long double coshl(long double arg)
ADf< float, DIM > log1pf(const ADf< float, DIM > &a)
ADf< T, DIM > log10(const ADf< T, DIM > &a)
ADf< T, DIM > atan(const ADf< T, DIM > &a)
ADf< long double, DIM > logl(const ADf< long double, DIM > &a)
ADf< float, DIM > ceilf(const ADf< float, DIM > &a)
ADf< T, DIM > atanh(const ADf< T, DIM > &a)
any_platform float coshf(float x)
ADf< T, DIM > log2(const ADf< T, DIM > &a)
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Top level namespace for all of OpenLB.