|
13 | 13 | * {@link http://prado.sourceforge.net/}
|
14 | 14 | *
|
15 | 15 | * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
|
16 |
| - * @version $Id: sfNumberFormat.class.php 28723 2010-03-23 16:37:43Z FabianLange $ |
| 16 | + * @version $Id: sfNumberFormat.class.php 32678 2011-06-29 16:43:32Z fabien $ |
17 | 17 | * @package symfony
|
18 | 18 | * @subpackage i18n
|
19 | 19 | */
|
@@ -86,7 +86,7 @@ function __construct($formatInfo = null)
|
86 | 86 | }
|
87 | 87 | else if ($formatInfo instanceof sfCultureInfo)
|
88 | 88 | {
|
89 |
| - $this->formatInfo = $formatInfo->sfNumberFormat; |
| 89 | + $this->formatInfo = $formatInfo->getNumberFormat(); |
90 | 90 | }
|
91 | 91 | else if ($formatInfo instanceof sfNumberFormatInfo)
|
92 | 92 | {
|
@@ -329,8 +329,14 @@ protected function fixFloat($float)
|
329 | 329 |
|
330 | 330 | list($significand, $exp) = explode('E', $string);
|
331 | 331 | list(, $decimal) = explode('.', $significand);
|
332 |
| - $exp = str_replace('+', '', $exp) - strlen($decimal); |
| 332 | + if ('-' === $exp[0]) { |
| 333 | + $exp = str_replace('-', '', $exp); |
333 | 334 |
|
334 |
| - return str_replace('.', '', $significand).str_repeat('0', $exp); |
| 335 | + return '0.'.str_repeat('0', $exp).str_replace('.', '', $significand); |
| 336 | + } else { |
| 337 | + $exp = str_replace('+', '', $exp) - strlen($decimal); |
| 338 | + |
| 339 | + return str_replace('.', '', $significand).str_repeat('0', $exp); |
| 340 | + } |
335 | 341 | }
|
336 | 342 | }
|
0 commit comments