From 292f6dac76429a7e1343c747f93c152ff2b37093 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 21 Mar 2013 23:56:37 -0400 Subject: Correct ldexp(0, ...) --- mathfuncs_fabs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mathfuncs_fabs.h') 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 realvec_t mathfuncs::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 -- cgit v1.1