mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-24 04:55:55 +00:00
Produce "nan" and "inf" strings instead of aborting
This commit is contained in:
parent
228567364f
commit
12784de211
@ -377,9 +377,16 @@ inline void Prettify(std::string &buffer, int length, int k) {
|
||||
inline std::string dtoa_milo(double value) {
|
||||
std::string buffer;
|
||||
|
||||
// Not handling NaN and inf
|
||||
assert(!isnan(value));
|
||||
assert(!isinf(value));
|
||||
if (isnan(value)) {
|
||||
return "nan";
|
||||
}
|
||||
if (isinf(value)) {
|
||||
if (value < 0) {
|
||||
return "-inf";
|
||||
} else {
|
||||
return "inf";
|
||||
}
|
||||
}
|
||||
|
||||
if (value == 0) {
|
||||
buffer = "0";
|
||||
|
Loading…
x
Reference in New Issue
Block a user