diff options
Diffstat (limited to 'Zend/zend_operators.c')
| -rw-r--r-- | Zend/zend_operators.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 285cce834d..d9556e77f2 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1764,3 +1764,21 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); } } + +ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) +{ + double dval = op->value.dval; + + TSRMLS_FETCH(); + + op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); + sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); + op->value.str.len = strlen(op->value.str.val); + + if (EG(float_separator)[0] != '.') { + char *p = op->value.str.val; + if ((p = strchr(p, '.'))) { + *p = EG(float_separator)[0]; + } + } +}
\ No newline at end of file |
