summaryrefslogtreecommitdiffstats
path: root/mathfuncs_rcp.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-07-03 14:37:41 -0400
committerErik Schnetter <schnetter@gmail.com>2013-07-03 14:37:41 -0400
commit5cf17048cebfabe2b79685d734e9c0c4632bf724 (patch)
treed1442f10ef2217baaf27ff342588331608c29b5e /mathfuncs_rcp.h
parentfb618d40212ff602f0e91833a99f95e134eef7ad (diff)
downloadvecmathlib-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.h14
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
OpenPOWER on IntegriCloud