Skip to content

Commit c0e251d

Browse files
committed
portable macros
1 parent 4cb8f84 commit c0e251d

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/csrc/scalar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ PyObject* longdouble_to_pylong(long double value)
513513
static Sleef_quad
514514
longdouble_to_quad(long double value)
515515
{
516-
if (isnanl(value) || isinfl(value) || value == 0.0L)
516+
if (isnan(value) || isinf(value) || value == 0.0L)
517517
return Sleef_cast_from_doubleq1((double)value);
518518

519519
int exp;

src/csrc/scalar_ops.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
#define NPY_TARGET_VERSION NPY_2_4_API_VERSION
44
#define NO_IMPORT_ARRAY
55

6+
#include <cmath>
7+
68
extern "C" {
79
#include <Python.h>
8-
#include <math.h>
910

1011
#include "numpy/arrayobject.h"
1112
#include "numpy/ndarraytypes.h"
@@ -243,12 +244,12 @@ QuadPrecision_int(QuadPrecisionObject *self)
243244
}
244245

245246
long double value = self->value.longdouble_value;
246-
if(isnanl(value))
247+
if(std::isnan(value))
247248
{
248249
PyErr_SetString(PyExc_ValueError, "cannot convert float NaN to integer");
249250
return NULL;
250251
}
251-
if(isinfl(value))
252+
if(std::isinf(value))
252253
{
253254
PyErr_SetString(PyExc_OverflowError, "cannot convert float infinity to integer");
254255
return NULL;

0 commit comments

Comments
 (0)