diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2002-10-12 21:15:35 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2002-10-12 21:15:35 +0000 |
| commit | e842ef9f4b784b11a87a4f006db6e5b28552b1b5 (patch) | |
| tree | 631add01c9d8f843a5cc3a78d497e1eea8783af5 /Zend/zend_operators.c | |
| parent | 06455b10bfabaea15e2a560688674fbc8569ff57 (diff) | |
| download | php-git-e842ef9f4b784b11a87a4f006db6e5b28552b1b5.tar.gz | |
MFZE1 (floats & locale issue)
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 |
