diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-03-21 23:56:37 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-03-21 23:56:37 -0400 |
commit | 292f6dac76429a7e1343c747f93c152ff2b37093 (patch) | |
tree | ba24db0875da6f4694d10ae4adfee9570607fc5a /mathfuncs_fabs.h | |
parent | 426f02cd14671a15424420adb9ba5735780e1c97 (diff) | |
download | vecmathlib-292f6dac76429a7e1343c747f93c152ff2b37093.zip vecmathlib-292f6dac76429a7e1343c747f93c152ff2b37093.tar.gz |
Correct ldexp(0, ...)
Diffstat (limited to 'mathfuncs_fabs.h')
-rw-r--r-- | mathfuncs_fabs.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mathfuncs_fabs.h b/mathfuncs_fabs.h index d924b9a..675ef5d 100644 --- a/mathfuncs_fabs.h +++ b/mathfuncs_fabs.h @@ -106,8 +106,9 @@ namespace vecmathlib { template<typename realvec_t> realvec_t mathfuncs<realvec_t>::vml_ldexp(realvec_t x, intvec_t n) { - return as_float(as_int(x) + (n << I(FP::mantissa_bits))); - // return x * as_float((n + exponent_offset) << mantissa_bits); + realvec_t r = as_float(as_int(x) + (n << I(FP::mantissa_bits))); + r = ifthen((as_int(x) & IV(FP::exponent_mask)) == IV(I(0)), x, r); + return r; } template<typename realvec_t> |