Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0bf1805

Browse files
committed
use C++ std::isnan() instead of our own
svn path=/trunk/matplotlib/; revision=3518
1 parent 86b3cc2 commit 0bf1805

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/_backend_agg.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "_backend_agg.h"
2424
#include "_transforms.h"
2525
#include "mplutils.h"
26-
#include "MPL_isnan.h"
2726

2827
#include "swig_runtime.h"
2928

@@ -1585,7 +1584,7 @@ RendererAgg::draw_lines(const Py::Tuple& args) {
15851584
moveto = true;
15861585
continue;
15871586
}
1588-
if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) {
1587+
if (std::isnan(thisx) || std::isnan(thisy)) {
15891588
moveto = true;
15901589
continue;
15911590
}

src/_transforms.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include <functional>
22
#include <limits>
3+
#include <cmath>
4+
35
#include <math.h>
46

57
#include "_transforms.h"
68
#include "mplutils.h"
7-
#include "MPL_isnan.h"
89

910
#include "numpy/arrayobject.h"
1011

@@ -472,7 +473,7 @@ Bbox::update(const Py::Tuple &args) {
472473
tup = xys[i];
473474
double x = Py::Float(tup[0]);
474475
double y = Py::Float(tup[1]);
475-
if (MPL_isnan64(x) || MPL_isnan64(y)) continue;
476+
if (std::isnan(x) || std::isnan(y)) continue;
476477
_posx.update(x);
477478
_posy.update(y);
478479
if (x<minx) minx=x;
@@ -537,7 +538,7 @@ Bbox::update_numerix_xy(const Py::Tuple &args) {
537538
for (size_t i=0; i< Nxy; ++i) {
538539
thisx = *(double *)(xyin->data + i*xyin->strides[0]);
539540
thisy = *(double *)(xyin->data + i*xyin->strides[0] + xyin->strides[1]);
540-
if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) continue;
541+
if (std::isnan(thisx) || std::isnan(thisy)) continue;
541542
_posx.update(thisx);
542543
_posy.update(thisy);
543544
if (thisx<minx) minx=thisx;
@@ -611,7 +612,7 @@ Bbox::update_numerix(const Py::Tuple &args) {
611612
for (size_t i=0; i< Nx; ++i) {
612613
thisx = *(double *)(x->data + i*x->strides[0]);
613614
thisy = *(double *)(y->data + i*y->strides[0]);
614-
if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) continue;
615+
if (std::isnan(thisx) || std::isnan(thisy)) continue;
615616
_posx.update(thisx);
616617
_posy.update(thisy);
617618
if (thisx<minx) minx=thisx;
@@ -1253,12 +1254,12 @@ Transformation::nonlinear_only_numerix(const Py::Tuple & args, const Py::Dict &k
12531254

12541255
double thisx = *(double *)(x->data + i*x->strides[0]);
12551256
double thisy = *(double *)(y->data + i*y->strides[0]);
1256-
if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) {
1257+
if (std::isnan(thisx) || std::isnan(thisy)) {
12571258
if (returnMask) {
12581259
*(unsigned char *)(retmask->data + i*retmask->strides[0]) = 0;
12591260
}
12601261
double MPLnan; // don't require C99 math features - find our own nan
1261-
if (MPL_isnan64(thisx)) {
1262+
if (std::isnan(thisx)) {
12621263
MPLnan=thisx;
12631264
} else {
12641265
MPLnan=thisy;

0 commit comments

Comments
 (0)