Use std::isinf() and std::isnan() instead of the C versions

According to https://github.com/mapbox/tippecanoe/issues/464 this
is necessary for g++-5 on Linux
This commit is contained in:
Eric Fischer 2017-09-07 14:40:50 -07:00
parent c3d23675d1
commit 84a6aa6d73

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
#include <cmath>
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include "msinttypes/stdint.h" #include "msinttypes/stdint.h"
@ -379,10 +380,10 @@ inline void Prettify(std::string &buffer, int length, int k) {
inline std::string dtoa_milo(double value) { inline std::string dtoa_milo(double value) {
std::string buffer; std::string buffer;
if (isnan(value)) { if (std::isnan(value)) {
return "nan"; return "nan";
} }
if (isinf(value)) { if (std::isinf(value)) {
if (value < 0) { if (value < 0) {
return "-inf"; return "-inf";
} else { } else {