summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vec_pseudo.h16
-rw-r--r--vec_sse_double1.h11
-rw-r--r--vec_sse_float1.h11
3 files changed, 27 insertions, 11 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;
}
diff --git a/vec_sse_double1.h b/vec_sse_double1.h
index 76487af..3dbf287 100644
--- a/vec_sse_double1.h
+++ b/vec_sse_double1.h
@@ -8,6 +8,7 @@
#include "vec_base.h"
#include <cmath>
+#include <climits>
// SSE2 intrinsics
#include <emmintrin.h>
@@ -425,7 +426,7 @@ namespace vecmathlib {
realvec r = std::frexp(v, &iri);
ir.v = iri;
if (isinf()) ir.v = std::numeric_limits<int_t>::max();
- if (isnan()) ir.v = std::numeric_limits<int_t>::max();
+ if (isnan()) ir.v = std::numeric_limits<int_t>::min();
return r;
}
realvec hypot(realvec y) const { return MF::vml_hypot(*this, y); }
@@ -435,10 +436,14 @@ namespace vecmathlib {
typedef std::numeric_limits<int_t> NL;
if (FP_ILOGB0 != NL::min() and v == R(0.0)) {
r = NL::min();
-#if defined VML_HAVE_NAN
- } else if (FP_ILOGBNAN != NL::max() and std::isnan(v)) {
+#if defined VML_HAVE_INF
+ } else if (INT_MAX != NL::max() and std::isinf(v)) {
r = NL::max();
#endif
+#if defined VML_HAVE_NAN
+ } else if (FP_ILOGBNAN != NL::min() and std::isnan(v)) {
+ r = NL::min();
+#endif
}
return r;
}
diff --git a/vec_sse_float1.h b/vec_sse_float1.h
index 2ef20bd..53b114c 100644
--- a/vec_sse_float1.h
+++ b/vec_sse_float1.h
@@ -8,6 +8,7 @@
#include "vec_base.h"
#include <cmath>
+#include <climits>
// SSE2 intrinsics
#include <emmintrin.h>
@@ -423,7 +424,7 @@ namespace vecmathlib {
{
realvec r = std::frexp(v, &ir.v);
if (isinf()) ir.v = std::numeric_limits<int_t>::max();
- if (isnan()) ir.v = std::numeric_limits<int_t>::max();
+ if (isnan()) ir.v = std::numeric_limits<int_t>::min();
return r;
}
realvec hypot(realvec y) const { return MF::vml_hypot(*this, y); }
@@ -433,10 +434,14 @@ namespace vecmathlib {
typedef std::numeric_limits<int_t> NL;
if (FP_ILOGB0 != NL::min() and *this == RV(R(0.0))) {
r = NL::min();
-#if defined VML_HAVE_NAN
- } else if (FP_ILOGBNAN != NL::max() and isnan()) {
+#if defined VML_HAVE_INF
+ } else if (INT_MAX != NL::max() and std::isinf(v)) {
r = NL::max();
#endif
+#if defined VML_HAVE_NAN
+ } else if (FP_ILOGBNAN != NL::min() and isnan()) {
+ r = NL::min();
+#endif
}
return r;
}
OpenPOWER on IntegriCloud