summaryrefslogtreecommitdiffstats
path: root/vec_pseudo.h
diff options
context:
space:
mode:
Diffstat (limited to 'vec_pseudo.h')
-rw-r--r--vec_pseudo.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/vec_pseudo.h b/vec_pseudo.h
index 1e78fb7..b8aa808 100644
--- a/vec_pseudo.h
+++ b/vec_pseudo.h
@@ -9,6 +9,7 @@
#include <algorithm>
#include <cmath>
+#include <climits>
#include <string>
#include <sstream>
@@ -750,13 +751,14 @@ namespace vecmathlib {
{
realvec_t res;
for (int d=0; d<size; ++d) {
- int ir;
- real_t r = std::frexp(v[d], &ir);
+ int iri;
+ real_t r = std::frexp(v[d], &iri);
+ int_t ir = iri;
#if defined VML_HAVE_INF
if (std::isinf(v[d])) ir = std::numeric_limits<int_t>::max();
#endif
#if defined VML_HAVE_NAN
- if (std::isnan(v[d])) ir = std::numeric_limits<int_t>::max();
+ if (std::isnan(v[d])) ir = std::numeric_limits<int_t>::min();
#endif
res.v[d] = r;
ires.v[d] = ir;
@@ -772,10 +774,14 @@ namespace vecmathlib {
typedef std::numeric_limits<int_t> NL;
if (FP_ILOGB0 != NL::min() and v[d] == R(0.0)) {
r = NL::min();
-#if defined VML_HAVE_NAN
- } else if (FP_ILOGBNAN != NL::max() and std::isnan(v[d])) {
+#if defined VML_HAVE_INF
+ } else if (INT_MAX != NL::max() and std::isinf(v[d])) {
r = NL::max();
#endif
+#if defined VML_HAVE_NAN
+ } else if (FP_ILOGBNAN != NL::min() and std::isnan(v[d])) {
+ r = NL::min();
+#endif
}
res.v[d] = r;
}
OpenPOWER on IntegriCloud