mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-30 04:29:15 +01:00
Increase float pretty printing precision
This removes the reliance on the "precision" ini setting. Furthermore the default of precision=14 is not sufficient.
This commit is contained in:
parent
23bf4f0c13
commit
648800f07f
@ -96,7 +96,7 @@ class Standard extends PrettyPrinterAbstract
|
||||
}
|
||||
|
||||
public function pScalar_DNumber(Scalar\DNumber $node) {
|
||||
$stringValue = (string) $node->value;
|
||||
$stringValue = sprintf('%.16G', $node->value);
|
||||
|
||||
// ensure that number is really printed as float
|
||||
return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
|
||||
|
@ -37,6 +37,7 @@ FALSE;
|
||||
1e1000;
|
||||
1E-100;
|
||||
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
|
||||
378282246310005.0;
|
||||
|
||||
// strings (normalized to single quoted)
|
||||
'a';
|
||||
@ -112,6 +113,7 @@ FALSE;
|
||||
INF;
|
||||
1.0E-100;
|
||||
1.0E+84;
|
||||
378282246310005.0;
|
||||
// strings (normalized to single quoted)
|
||||
'a';
|
||||
'a
|
||||
|
Loading…
Reference in New Issue
Block a user