Hello,
We've been here before, but it is still a problem. I formatted this
one using Boost.Format, "%1$.20f", especially dealing with 64-bit
floating point values:
"-6454866677007257221799838306103363329054216765979693126687924767750184064408021645577150612734391912932504859271476290909819606665305867922002041825515395649967939044362235953753132737391831714484437364695236622971838510661738713863719312223765488747173369566663518205119012003640541309414736378162701139968.00000000000000000000"
Grammar is defined:
numeric_sign %= (
('-' >> attr(numeric_sign_minus))
| ('+' >> attr(numeric_sign_plus))
)
;
float_lit %= real_parser>{};
floating_point %= -numeric_sign >> float_lit;
With rules defined as:
qi::rule numeric_sign;
qi::rule float_lit;
qi::rule floating_point;
Where float_t is a defined part of the AST:
using float_t = double;
And floating_point maps to the floating_point_number_t, basically
mapping the Sign and Value.
Seems like we've been here before with inadequate response, however,
reading the Boost documentation, I do not see any reason any Qi should
be rejecting this value:
https://www.boost.org/doc/libs/1_69_0/libs/spirit/doc/html/spirit/qi/referen...
Particularly the RealPolicies:
sign
= lit('+') | '-'
;
nan
= -lit("1.0#") >> no_case["nan"]
>> -('(' >> *(char_ - ')') >> ')')
;
inf
= no_case[lit("inf") >> -lit("inity")]
;
floating_literal
= -sign >>
( nan
| inf
| fractional_constant >> -exponent_part
| +digit >> exponent_part
)
;
fractional_constant
= *digit >> '.' >> +digit
| +digit >> -lit('.')
;
exponent_part
= (lit('e') | 'E') >> -sign >> +digit
;
Although the concern I have is that the RealPolicy grammar defined
above is not implemented as Qi Rules, per se, but rather brute force.
In other words, error prone in the ways that a brute force approach is
error prone.
Best regards,
Michael Powell