From ee78214d9a8aa7bb836e2e23151d0d4260ded6ee Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Sun, 4 May 2014 11:18:45 -0400 Subject: [PATCH] If the float is infinite, print the INF constant --- lib/Rascal/RascalPrinter.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Rascal/RascalPrinter.php b/lib/Rascal/RascalPrinter.php index 99d4a95206..c4f00d2876 100644 --- a/lib/Rascal/RascalPrinter.php +++ b/lib/Rascal/RascalPrinter.php @@ -1002,8 +1002,12 @@ public function pprintParam(\PhpParser\Node\Param $node) public function pprintDNumberScalar(\PhpParser\Node\Scalar\DNumber $node) { - $fragment = "float(" . sprintf('%f', $node->value) . ")"; - $fragment = "scalar(" . $fragment . ")"; + if (is_infinite($node->value)) { + $fragment = "fetchConst(name(\"INF\"))"; + } else { + $fragment = "float(" . sprintf('%f', $node->value) . ")"; + $fragment = "scalar(" . $fragment . ")"; + } $fragment .= $this->annotateASTNode($node); return $fragment;