summaryrefslogtreecommitdiffstats
path: root/mathfuncs_convert.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-06-20 11:23:28 -0400
committerErik Schnetter <schnetter@gmail.com>2013-06-20 11:23:28 -0400
commit885313fb40a521892784540d038930a48e284273 (patch)
treee65378bcbebeb05b3444db8333a8ebdbdca08855 /mathfuncs_convert.h
parent7433525f9886a22956670202b5203e843cf41e5c (diff)
downloadvecmathlib-885313fb40a521892784540d038930a48e284273.zip
vecmathlib-885313fb40a521892784540d038930a48e284273.tar.gz
Improve efficiency of round
Diffstat (limited to 'mathfuncs_convert.h')
-rw-r--r--mathfuncs_convert.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/mathfuncs_convert.h b/mathfuncs_convert.h
index 841ded4..70aedc2 100644
--- a/mathfuncs_convert.h
+++ b/mathfuncs_convert.h
@@ -125,7 +125,8 @@ namespace vecmathlib {
template<typename realvec_t>
realvec_t mathfuncs<realvec_t>::vml_round(realvec_t x)
{
- return copysign(floor(fabs(x)+RV(0.5)), x);
+ // return copysign(floor(fabs(x)+RV(0.5)), x);
+ return trunc(x + copysign(RV(0.5), x));
}
// Round to next integer towards zero
OpenPOWER on IntegriCloud