From:             ehanneken at pobox dot com
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  Floating point grammar omits signed numbers

Description:
------------
According to the manual
(http://www.php.net/manual/en/language.types.float.php), the following
grammar specifies floating point numbers:

LNUM          [0-9]+
DNUM          ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*)
EXPONENT_DNUM ( ({LNUM} | {DNUM}) [eE][+-]? {LNUM})

This leaves out signed numbers.  The grammar should be written as
something like

ULNUM          [0-9]+
SLNUM          [+-]{ULNUM}
DNUM           [+-]?(([0-9]*[\.]{ULNUM}) | ({ULNUM}[\.][0-9]*))
EXPONENT_DNUM  [+-]?( ({ULNUM} | {DNUM}) [eE][+-]? {ULNUM})


Reproduce code:
---------------
echo gettype(-3.14) . "\n";
echo gettype(+3.14);


Expected result:
----------------
double
double

Actual result:
--------------
double
double

-- 
Edit bug report at http://bugs.php.net/?id=40996&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40996&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40996&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40996&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40996&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40996&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40996&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40996&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40996&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40996&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40996&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40996&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40996&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40996&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40996&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40996&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40996&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40996&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40996&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40996&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40996&r=mysqlcfg

Reply via email to