ID: 40996 User updated by: ehanneken at pobox dot com Reported By: ehanneken at pobox dot com Status: Open Bug Type: Documentation problem PHP Version: Irrelevant New Comment:
There was a bug in my revised grammer, too. How about this? ULNUM [0-9]+ SLNUM [+-]{ULNUM} DNUM [+-]?(([0-9]*[\.]{ULNUM}) | ({ULNUM}[\.][0-9]*)) EXPONENT_DNUM ( ({SLNUM} | {DNUM}) [eE][+-]? {ULNUM}) Previous Comments: ------------------------------------------------------------------------ [2007-04-04 14:56:00] ehanneken at pobox dot com 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 this bug report at http://bugs.php.net/?id=40996&edit=1