|
1 | 1 | #include <functional> |
2 | 2 | #include <limits> |
3 | | -#include <cmath> |
4 | 3 |
|
5 | 4 | #include <math.h> |
6 | 5 |
|
7 | 6 | #include "_transforms.h" |
8 | 7 | #include "mplutils.h" |
9 | 8 |
|
10 | 9 | #include "numpy/arrayobject.h" |
| 10 | +#include "MPL_isnan.h" |
11 | 11 |
|
12 | 12 | Value::~Value() { |
13 | 13 | _VERBOSE("Value::~Value"); |
@@ -473,7 +473,7 @@ Bbox::update(const Py::Tuple &args) { |
473 | 473 | tup = xys[i]; |
474 | 474 | double x = Py::Float(tup[0]); |
475 | 475 | double y = Py::Float(tup[1]); |
476 | | - if (std::isnan(x) || std::isnan(y)) continue; |
| 476 | + if (MPL_isnan64(x) || MPL_isnan64(y)) continue; |
477 | 477 | _posx.update(x); |
478 | 478 | _posy.update(y); |
479 | 479 | if (x<minx) minx=x; |
@@ -538,7 +538,7 @@ Bbox::update_numerix_xy(const Py::Tuple &args) { |
538 | 538 | for (size_t i=0; i< Nxy; ++i) { |
539 | 539 | thisx = *(double *)(xyin->data + i*xyin->strides[0]); |
540 | 540 | thisy = *(double *)(xyin->data + i*xyin->strides[0] + xyin->strides[1]); |
541 | | - if (std::isnan(thisx) || std::isnan(thisy)) continue; |
| 541 | + if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) continue; |
542 | 542 | _posx.update(thisx); |
543 | 543 | _posy.update(thisy); |
544 | 544 | if (thisx<minx) minx=thisx; |
@@ -612,7 +612,7 @@ Bbox::update_numerix(const Py::Tuple &args) { |
612 | 612 | for (size_t i=0; i< Nx; ++i) { |
613 | 613 | thisx = *(double *)(x->data + i*x->strides[0]); |
614 | 614 | thisy = *(double *)(y->data + i*y->strides[0]); |
615 | | - if (std::isnan(thisx) || std::isnan(thisy)) continue; |
| 615 | + if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) continue; |
616 | 616 | _posx.update(thisx); |
617 | 617 | _posy.update(thisy); |
618 | 618 | if (thisx<minx) minx=thisx; |
@@ -1254,12 +1254,12 @@ Transformation::nonlinear_only_numerix(const Py::Tuple & args, const Py::Dict &k |
1254 | 1254 |
|
1255 | 1255 | double thisx = *(double *)(x->data + i*x->strides[0]); |
1256 | 1256 | double thisy = *(double *)(y->data + i*y->strides[0]); |
1257 | | - if (std::isnan(thisx) || std::isnan(thisy)) { |
| 1257 | + if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) { |
1258 | 1258 | if (returnMask) { |
1259 | 1259 | *(unsigned char *)(retmask->data + i*retmask->strides[0]) = 0; |
1260 | 1260 | } |
1261 | 1261 | double MPLnan; // don't require C99 math features - find our own nan |
1262 | | - if (std::isnan(thisx)) { |
| 1262 | + if (MPL_isnan64(thisx)) { |
1263 | 1263 | MPLnan=thisx; |
1264 | 1264 | } else { |
1265 | 1265 | MPLnan=thisy; |
|
0 commit comments