From 67d6464525363c36cb4cf1381e90d909c31a14f4 Mon Sep 17 00:00:00 2001 From: Greg Wuller Date: Wed, 17 Jan 2024 21:18:14 -0800 Subject: [PATCH] fix: Use std::isnan and std::isinf consistently --- source/DSP/MLDSPScalarMath.h | 8 ++++---- source/app/MLTextUtils.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/DSP/MLDSPScalarMath.h b/source/DSP/MLDSPScalarMath.h index 79b6b9d9..feb717f4 100644 --- a/source/DSP/MLDSPScalarMath.h +++ b/source/DSP/MLDSPScalarMath.h @@ -129,13 +129,13 @@ inline int ilog2(int x) return b; } -inline int isNaN(float x) { return isnan(x); } +inline int isNaN(float x) { return std::isnan(x); } -inline int isNaN(double x) { return isnan(x); } +inline int isNaN(double x) { return std::isnan(x); } -inline int isInfinite(float x) { return isinf(x); } +inline int isInfinite(float x) { return std::isinf(x); } -inline int isInfinite(double x) { return isinf(x); } +inline int isInfinite(double x) { return std::isinf(x); } inline float smoothstep(float a, float b, float x) { diff --git a/source/app/MLTextUtils.cpp b/source/app/MLTextUtils.cpp index dbc1de63..89ae9032 100644 --- a/source/app/MLTextUtils.cpp +++ b/source/app/MLTextUtils.cpp @@ -5,6 +5,7 @@ #include "MLTextUtils.h" #include +#include #include "MLDSPScalarMath.h" #include "MLMemoryUtils.h" @@ -194,7 +195,7 @@ TextFragment floatNumberToText(float f, int precision) float value = f; const int digitsAfterDecimal{std::min(precision, kMaxPrecision)}; - if (isnan(f)) + if (std::isnan(f)) { *writePtr++ = 'n'; *writePtr++ = 'a';