note 50082 added to language.types.float
| From: | edsko at edsko dot net | Date: | Thu, 17 Feb 2005 12:31:01 +0000 |
| Subject: | note 50082 added to language.types.float | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85162@lists.php.net to get a copy of this message | ||
The formal specification of the floating point numbers as specified above is not complete. For one
thing, it is not immediately obvious which of the three rules describes "floating point
numbers" (in general). The disjunction of all three perhaps? My interpretation is that a
floating point number is either a DNUM or an EXPONENT_DNUM.
Moreover, the specification as stated does not allow for signs (+ or -). Yet, PHP does actually
allow for signs in the specification of floating point numbers (as one would expect):
<?php
$f = (float) "-0.5";
var_dump($f); // outputs "float(-0.5)"
?>
Thus, the following specification is more complete:
FLOAT [+-]?({DNUM}|{EXPONENT_DNUM})
LNUM [0-9]+
DNUM ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*)
EXPONENT_DNUM ( ({LNUM} | {DNUM}) [eE][+-]? {LNUM})
----
Manual Page -- http://www.php.net/manual/en/language.types.float.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50082
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50082&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50082&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50082&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50082&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50082&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50082&report=yes
Search -- http://master.php.net/manage/user-notes.php