diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-11-25 14:52:26 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-11-25 14:52:26 -0500 |
commit | ec33e3b30b4324cad3f5c26186cc2d2620708a0f (patch) | |
tree | c8f74527bcc52e2f219e6f8a953dd86d5597a75d /mathfuncs_convert.h | |
parent | 89edeef77f22823a1f2cebd46699a29df9d43d95 (diff) | |
download | vecmathlib-ec33e3b30b4324cad3f5c26186cc2d2620708a0f.zip vecmathlib-ec33e3b30b4324cad3f5c26186cc2d2620708a0f.tar.gz |
Provide lrint
Diffstat (limited to 'mathfuncs_convert.h')
-rw-r--r-- | mathfuncs_convert.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mathfuncs_convert.h b/mathfuncs_convert.h index 70aedc2..79befbc 100644 --- a/mathfuncs_convert.h +++ b/mathfuncs_convert.h @@ -121,6 +121,14 @@ namespace vecmathlib { return ifthen(x<RV(0.0), vml_antitrunc(x), trunc(x)); } + // Round to nearest integer, breaking ties using prevailing rounding + // mode (default: round to even), returning an integer + template<typename realvec_t> + typename realvec_t::intvec_t mathfuncs<realvec_t>::vml_lrint(realvec_t x) + { + return convert_int(rint(x)); + } + // Round to nearest integer, breaking ties away from zero template<typename realvec_t> realvec_t mathfuncs<realvec_t>::vml_round(realvec_t x) |