summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-09-29 23:44:07 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-09-29 23:44:07 +0000
commit6ac36d1a00dcac81642cc0ffc8cefec88ff42c1b (patch)
tree76f22c3b19fe3914e770408347c6dcaa977c0291
parent86bf200e92b64f56853bad3c60840c38b581beb0 (diff)
downloadphp-git-6ac36d1a00dcac81642cc0ffc8cefec88ff42c1b.tar.gz
More NaN & INF handling fixes.
-rw-r--r--main/snprintf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main/snprintf.c b/main/snprintf.c
index 797b50e989..7fd2ff5a5b 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -954,6 +954,22 @@ static int format_converter(register buffy * odp, const char *fmt,
default:
goto fmt_error;
}
+
+ if (zend_isnan(fp_num)) {
+ s = "NAN";
+ s_len = 3;
+ break;
+ } else if (zend_isinf(fp_num)) {
+ if (fp_num > 0) {
+ s = "INF";
+ s_len = 3;
+ } else {
+ s = "-INF";
+ s_len = 4;
+ }
+ break;
+ }
+
if (adjust_precision == NO)
precision = FLOAT_DIGITS;
else if (precision == 0)