mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Produce "nan" and "inf" strings instead of aborting
This commit is contained in:
+10
-3
@@ -377,9 +377,16 @@ 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;
|
||||||
|
|
||||||
// Not handling NaN and inf
|
if (isnan(value)) {
|
||||||
assert(!isnan(value));
|
return "nan";
|
||||||
assert(!isinf(value));
|
}
|
||||||
|
if (isinf(value)) {
|
||||||
|
if (value < 0) {
|
||||||
|
return "-inf";
|
||||||
|
} else {
|
||||||
|
return "inf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
buffer = "0";
|
buffer = "0";
|
||||||
|
|||||||
Reference in New Issue
Block a user