summaryrefslogtreecommitdiffstats
path: root/mathfuncs_rcp.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2012-12-01 13:51:20 -0500
committerErik Schnetter <schnetter@gmail.com>2012-12-01 13:51:20 -0500
commitcc75e470ce2a6975ff2092af614daf5e5a96702e (patch)
treea4750ae16affba0f2b49ccb9e82e61233c8a506b /mathfuncs_rcp.h
parent1d94d7894b3802497833de2d465529118e1f70c5 (diff)
downloadvecmathlib-cc75e470ce2a6975ff2092af614daf5e5a96702e.zip
vecmathlib-cc75e470ce2a6975ff2092af614daf5e5a96702e.tar.gz
Implement ceil floor fmod pow remainder round
Diffstat (limited to 'mathfuncs_rcp.h')
-rw-r--r--mathfuncs_rcp.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/mathfuncs_rcp.h b/mathfuncs_rcp.h
index 1704d8f..2b931c9 100644
--- a/mathfuncs_rcp.h
+++ b/mathfuncs_rcp.h
@@ -43,6 +43,22 @@ namespace vecmathlib {
return r;
}
+
+
+ template<typename realvec_t>
+ realvec_t mathfuncs<realvec_t>::vml_remainder(realvec_t x, realvec_t y)
+ {
+ return x - round(x / y) * y;
+ }
+
+ template<typename realvec_t>
+ realvec_t mathfuncs<realvec_t>::vml_fmod(realvec_t x, realvec_t y)
+ {
+ realvec_t r = fabs(x);
+ y = fabs(y);
+ return copysign(r - floor(r / y) * y, x);
+ }
+
}; // namespace vecmathlib
#endif // #ifndef MATHFUNCS_RCP_H
OpenPOWER on IntegriCloud