[Issue 4673] Bug in std.string (isNumeric)

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4673

Andrei Alexandrescu  changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 4673] Bug in std.string (isNumeric)

2013-12-27 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=4673


Dmitry Olshansky  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||dmitry.o...@gmail.com
 Resolution||FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2013-12-27 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=4673



--- Comment #11 from github-bugzi...@puremagic.com 2013-12-27 15:15:50 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/aca9995fa24f3610a9d5a15745f91f9dcf1c3075
Fix issue 4673

https://github.com/D-Programming-Language/phobos/commit/fd8e2bf6e124da59f37c650c2126fd72b096bf1b
Merge pull request #1207 from andralex/4673

Fix issue 4673 - Bug in std.string (isNumeric)

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2013-09-03 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673


Rob T  changed:

   What|Removed |Added

 CC||al...@ucora.com


--- Comment #10 from Rob T  2013-09-03 16:38:06 PDT ---
isNumeric still thinks strings containing only "-" "+" and "." are numeric.

Here is a related bug report with additional thoughts and a suggestion that the
conversion library should add a function to check if a given conversion will
succeed or not.
http://d.puremagic.com/issues/show_bug.cgi?id=3610

If isNumeric won't be fixed, then it should be depreciated rather than keep it
broken in the library. 

--rt

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2011-01-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673



--- Comment #9 from kenn...@gmail.com 2010-08-25 12:31:06 PDT ---
(In reply to comment #8)
> Created an attachment (id=740) [details]
> Improvements of the proposed patch
> 
> Well, I checked the lexical page about D2 and it seems that something like
> 1_2_3_4_5_._5_4e-5_2_ is a numeric, so I decided to make some changes to the
> regex to allow this kind of numerics.
> 
> But I wonder, should we consider hex things like 0xFFF as numerics or should 
> we
> have to make another function like "isHexadecimal" ?

The current isNumeric function also considered "123,456,789" numeric (with the
bAllowSep parameter set to true). May be there should be another function or
switch that handles "human-readable numeric string" and "number literals in D
syntax" differently.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673


Petit Vincent  changed:

   What|Removed |Added

 Attachment #733 is|0   |1
   obsolete||


--- Comment #8 from Petit Vincent  2010-08-25 19:52:47 
CEST ---
Created an attachment (id=740)
Improvements of the proposed patch

Well, I checked the lexical page about D2 and it seems that something like
1_2_3_4_5_._5_4e-5_2_ is a numeric, so I decided to make some changes to the
regex to allow this kind of numerics.

But I wonder, should we consider hex things like 0xFFF as numerics or should we
have to make another function like "isHexadecimal" ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673


Jonathan M Davis  changed:

   What|Removed |Added

 CC||jmdavisp...@gmail.com


--- Comment #7 from Jonathan M Davis  2010-08-20 
14:42:21 PDT ---
I though that they were doing the same with complex numbers that they did with
associative arrays, which was to remove it from the language itself but have
the compiler use a library solution for it (kind of like it using the object
module with Object in it rather than just knowing the definition). So, the
syntax would be the same, but how it would be dealt with internally would be
different. I could be wrong on that though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673



--- Comment #6 from kenn...@gmail.com 2010-08-20 14:13:56 PDT ---
Should complex literals ("3.4+5.6i") _still_ be considered numeric? As the
built-in complex types are scheduled for deprecation...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673



--- Comment #5 from Petit Vincent  2010-08-20 23:06:05 
CEST ---
Created an attachment (id=733)
Maybe a patch which works.

Well this is way to improve the current isNumeric function.

It works well for these kinds of numerics :

(+/-) 1, 1L, 1UL, 1i, 1Fi, 1Li, 1F
1.55
1e+52
1_500_250

nan, nani, nan+nani


(+/-) inf


At least, this patch correct bugs found in the std.isNumeric function.

Sure we can (should !) improve it but at least it works (except for numerics
like .5e-52 but 0.5e-52 works)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673


kenn...@gmail.com changed:

   What|Removed |Added

 CC||kenn...@gmail.com


--- Comment #4 from kenn...@gmail.com 2010-08-18 10:33:49 PDT ---
(In reply to comment #3)
> You are right, my reduced version was useless, this shows the problem:
> 
> import std.string: isNumeric;
> void main() {
> assert(isNumeric("F"));
> assert(isNumeric("L"));
> assert(isNumeric("U"));
> }

The following strings are also wrongly classified as numeric:

import std.string;
void main () {
  assert(isNumeric("i"));
  assert(isNumeric("fi"));
  assert(isNumeric("ul"));
  assert(isNumeric("li"));

  assert(isNumeric("."));
  assert(isNumeric("-"));
  assert(isNumeric("+"));
  assert(isNumeric("e-"));
  assert(isNumeric("e+"));
  assert(isNumeric(".f"));
  assert(isNumeric("e+f"));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673



--- Comment #3 from bearophile_h...@eml.cc 2010-08-18 04:07:13 PDT ---
You are right, my reduced version was useless, this shows the problem:

import std.string: isNumeric;
void main() {
assert(isNumeric("F"));
assert(isNumeric("L"));
assert(isNumeric("U"));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673



--- Comment #2 from Petit Vincent  2010-08-18 12:51:37 
CEST ---
(In reply to comment #1)
> This reduced case shows that parse() doesn't accept "F" or "L", so I don't see
> the problem yet:
> 
> 
> import std.conv;
> void main() {
> int n1 = parse!uint("F");
> int n2 = parse!uint("L");
> }

Some changes in your reduced case :

import std.conv;
import std.string;

void main() {
if(isNumeric("F"))// isNumeric("F") return True : since when "F" is a
numeric ?
{
int n1 = parse!uint("F");
}
if(isNumeric("L"))// same for "L"
{
int n2 = parse!uint("L");
}
if(isNumeric("U"))// same here ...
{
uint n3 = parse!uint("U");
}
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4673] Bug in std.string (isNumeric)

2010-08-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4673


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #1 from bearophile_h...@eml.cc 2010-08-18 03:44:53 PDT ---
This reduced case shows that parse() doesn't accept "F" or "L", so I don't see
the problem yet:


import std.conv;
void main() {
int n1 = parse!uint("F");
int n2 = parse!uint("L");
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---