summaryrefslogtreecommitdiffstats
path: root/mathfuncs_pow.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2015-10-16 13:45:31 -0400
committerErik Schnetter <schnetter@gmail.com>2015-10-16 13:45:31 -0400
commit06ddf9a62fd6e991dfcf0bd2abe0941b960cb2bb (patch)
tree793b48ebee5b9c779c8afd34cc20245c93b9ad9d /mathfuncs_pow.h
parent71a4a6821276690eed15df8d2c246be499da1e29 (diff)
downloadvecmathlib-06ddf9a62fd6e991dfcf0bd2abe0941b960cb2bb.zip
vecmathlib-06ddf9a62fd6e991dfcf0bd2abe0941b960cb2bb.tar.gz
Reformat source code with clang-format
Note: If you have an existing checkout with modifications, then you should: (1) save your current state on a branch (2) run clang-format on this branch (3) compare this branch to a fresh checkout of the clang-formatted master Since both your branch and master have been formatted with clang-format, this will lead to a very small diff, avoiding spurious changes due to formatting differences.
Diffstat (limited to 'mathfuncs_pow.h')
-rw-r--r--mathfuncs_pow.h43
1 files changed, 20 insertions, 23 deletions
diff --git a/mathfuncs_pow.h b/mathfuncs_pow.h
index b863570..70bcc80 100644
--- a/mathfuncs_pow.h
+++ b/mathfuncs_pow.h
@@ -7,30 +7,27 @@
#include <cmath>
+namespace vecmathlib {
+template <typename realvec_t>
+realvec_t mathfuncs<realvec_t>::vml_pow(realvec_t x, realvec_t y) {
+ // Handle zero
+ boolvec_t is_zero = x == RV(0.0);
+ x = ifthen(is_zero, RV(1.0), x);
+
+ realvec_t r = exp(log(fabs(x)) * y);
+
+ // The result is negative if x<0 and if y is integer and odd
+ realvec_t mod_y = fabs(y) - RV(2.0) * floor(RV(0.5) * fabs(y));
+ realvec_t sign = copysign(mod_y, x) + RV(0.5);
+ r = copysign(r, sign);
+
+ // Handle zero
+ r = ifthen(is_zero, RV(0.0), r);
+
+ return r;
+}
-namespace vecmathlib {
-
- template<typename realvec_t>
- realvec_t mathfuncs<realvec_t>::vml_pow(realvec_t x, realvec_t y)
- {
- // Handle zero
- boolvec_t is_zero = x == RV(0.0);
- x = ifthen(is_zero, RV(1.0), x);
-
- realvec_t r = exp(log(fabs(x)) * y);
-
- // The result is negative if x<0 and if y is integer and odd
- realvec_t mod_y = fabs(y) - RV(2.0) * floor(RV(0.5) * fabs(y));
- realvec_t sign = copysign(mod_y, x) + RV(0.5);
- r = copysign(r, sign);
-
- // Handle zero
- r = ifthen(is_zero, RV(0.0), r);
-
- return r;
- }
-
}; // namespace vecmathlib
-#endif // #ifndef MATHFUNCS_POW_H
+#endif // #ifndef MATHFUNCS_POW_H
OpenPOWER on IntegriCloud