From 80cf5e3d7965830d14a5a5bb4a1232c5e95a932b Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Sat, 29 Aug 2020 18:42:20 -0600 Subject: [PATCH] Modify isnan() operation --- libnczarr/zcvt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libnczarr/zcvt.c b/libnczarr/zcvt.c index c851653b2..62c234471 100644 --- a/libnczarr/zcvt.c +++ b/libnczarr/zcvt.c @@ -355,9 +355,9 @@ NCZ_stringconvert(nc_type typeid, size_t len, void* data0, NCjson** jdatap) #else if(isnan(d)) special = "NaN"; - else if(isinf(d) < 0) + else if(isinf(d) && d < 0) special = "-Infinity"; - else if(isinf(d) > 0) + else if(isinf(d) && d > 0) special = "Infinity"; else {} #endif @@ -368,7 +368,7 @@ NCZ_stringconvert(nc_type typeid, size_t len, void* data0, NCjson** jdatap) break; default: stat = NC_EINTERNAL; goto done; } - if(special) {nullfree(str); str = strdup(special);} + if(special) {nullfree(str); str = strdup(special);} jvalue->value = str; str = NULL; nclistpush(jdata->contents,jvalue);