diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-07-03 14:37:41 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-07-03 14:37:41 -0400 |
commit | 5cf17048cebfabe2b79685d734e9c0c4632bf724 (patch) | |
tree | d1442f10ef2217baaf27ff342588331608c29b5e /mathfuncs_rcp.h | |
parent | fb618d40212ff602f0e91833a99f95e134eef7ad (diff) | |
download | vecmathlib-5cf17048cebfabe2b79685d734e9c0c4632bf724.zip vecmathlib-5cf17048cebfabe2b79685d734e9c0c4632bf724.tar.gz |
Change implementation of fmod and remainder to be standard-conforming
Diffstat (limited to 'mathfuncs_rcp.h')
-rw-r--r-- | mathfuncs_rcp.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mathfuncs_rcp.h b/mathfuncs_rcp.h index e540f76..0349cc8 100644 --- a/mathfuncs_rcp.h +++ b/mathfuncs_rcp.h @@ -97,19 +97,17 @@ namespace vecmathlib { template<typename realvec_t> realvec_t mathfuncs<realvec_t>::vml_remainder(realvec_t x, realvec_t y) { - // return x - rint(x / y) * y; - realvec_t r = x / y; - return y * (r - rint(r)); + return x - rint(x / y) * y; + // realvec_t r = x / y; + // return y * (r - rint(r)); } 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); - realvec_t r = x / y; - return y * (r - trunc(r)); + return x - y * trunc(x / y); + // realvec_t r = x / y; + // return y * (r - trunc(r)); } }; // namespace vecmathlib |