Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] real_p fails on negative exponent
From: Jan Boehme (jan.boehme_at_[hidden])
Date: 2008-12-08 08:55:05


Hi Joel,

On Mon, Dec 8, 2008 at 2:07 PM, Joel de Guzman wrote:
>
> Jan Boehme wrote:
>>
>> Hi,
>>
>> on my system (RHEL3, libc 2.3.2, gcc 3.2.3, Intel 10.1 which is used to compile and link) real_p fails to parse real numbers like 1.0E-001 and it is most likely the negative exponent as 1.0E001 works as expected.
>> Our investigations brought us to numerics.hpp line 162 where the int parser which is used by real_p is declared as 'int_parser<T, 10, 1, -1>' with T=double. I don't see the reason for this yet and
>> the 'out of the box' int parser 'int_p' itself is declared using 'int_parser<int>'.
>>
>> Here my questions:
>> Do I have to expect any problems using int instead double for the real_p exp_n parser?
>> Is this a kind of a mistake as even int_p is declared using 'int'?
>
> Please post a minimal test case. I'd venture a guess that the problem
> is elsewhere. We do have real_p tests with negative exponents. And
> all is fine, as expected. I did test your case and it works fine:
>
> added this in numeric_tests.cpp:
>
> BOOST_TEST(parse("1.0E-001", real_p).full); // Good.

please have a look on my system specs. Maybe I should say that I haven't
any problems using a modern c++ compiler like gcc 4.2.4 plus intel 10.1.

You did provide a minimal test case yourself: this test runs fail on my
system using boost 1.37 and only my 'workaround' let this rule run
sucessfully on this machine. It consumes all chars including 'E' and
then '-' doesn't match. Did you try it on a gcc3.2.x too?

Thanks, Jan.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net