diff options
author | Erik Schnetter <schnetter@gmail.com> | 2012-12-01 13:51:20 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2012-12-01 13:51:20 -0500 |
commit | cc75e470ce2a6975ff2092af614daf5e5a96702e (patch) | |
tree | a4750ae16affba0f2b49ccb9e82e61233c8a506b /mathfuncs_rcp.h | |
parent | 1d94d7894b3802497833de2d465529118e1f70c5 (diff) | |
download | vecmathlib-cc75e470ce2a6975ff2092af614daf5e5a96702e.zip vecmathlib-cc75e470ce2a6975ff2092af614daf5e5a96702e.tar.gz |
Implement ceil floor fmod pow remainder round
Diffstat (limited to 'mathfuncs_rcp.h')
-rw-r--r-- | mathfuncs_rcp.h | 16 |
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 |