]> granicus.if.org Git - php/commitdiff
More NaN & INF handling fixes.
authorIlia Alshanetsky <iliaa@php.net>
Mon, 29 Sep 2003 23:44:07 +0000 (23:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 29 Sep 2003 23:44:07 +0000 (23:44 +0000)
main/snprintf.c

index 797b50e989dbd185ee9d3f83c4d6a2c725006722..7fd2ff5a5b0f2d9d88b2a2ff559228e125556a79 100644 (file)
@@ -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)