iliaa Mon Sep 29 19:44:17 2003 EDT Modified files: (Branch: PHP_4_3) /php-src/main snprintf.c Log: MFH: More NaN & INF handling fixes. Index: php-src/main/snprintf.c diff -u php-src/main/snprintf.c:1.17.4.8 php-src/main/snprintf.c:1.17.4.9 --- php-src/main/snprintf.c:1.17.4.8 Fri Aug 8 16:23:07 2003 +++ php-src/main/snprintf.c Mon Sep 29 19:44:17 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: snprintf.c,v 1.17.4.8 2003/08/08 20:23:07 helly Exp $ */ +/* $Id: snprintf.c,v 1.17.4.9 2003/09/29 23:44:17 iliaa Exp $ */ /* ==================================================================== * Copyright (c) 1995-1998 The Apache Group. All rights reserved. @@ -794,6 +794,23 @@ case 'g': case 'G': + fp_num = va_arg(ap, double); + + 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) @@ -801,8 +818,7 @@ /* * * We use &num_buf[ 1 ], so that we have room for the sign */ - s = ap_php_gcvt(va_arg(ap, double), precision, &num_buf[1], - alternate_form); + s = ap_php_gcvt(fp_num, precision, &num_buf[1], alternate_form); if (*s == '-') prefix_char = *s++; else if (print_sign)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php