bug in ``isNumeric''

Boyko Bantchev Boyko_member at pathlink.com
Mon Apr 3 23:59:59 PDT 2006


I believe there is a bug in the isNumeric library predicate.
It's description seems to say that it should accept valid
numbers and *not* accept anything else.  Still:

writefln(toString(isNumeric("+")));    // prints ``true''
writefln(toString(isNumeric("-")));    // prints ``true''
writefln(toString(isNumeric("+-")));   // prints ``false''
writefln(toString(isNumeric("-+")));   // prints ``true''
writefln(toString(isNumeric("+.")));   // prints ``true''
writefln(toString(isNumeric("-.")));   // prints ``true''
writefln(toString(isNumeric(".")));    // prints ``true''

The description of isNumeric in
is itself somewhat unclear, perhaps partly because it
contains a non-matched ]-character.


More information about the Digitalmars-d-bugs mailing list