We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a bug either in extract_uint or real parser.
extract_uint
From my point of view the bug is in extract_uint because:
IgnoreOverflowDigits
4294967296
429496729
4294967290
#include <boost/spirit/include/qi.hpp> namespace qi = boost::spirit::qi; int main() { { char const* s = "0.4294967296", *const e = s + std::strlen(s); std::cout << "=== float_ ===\n"; std::cout << "input: " << s << '\n'; float f; if (qi::parse(s, e, qi::float_, f)) std::cout << "result: " << f << '\n' << "expected: " << 0.4294967296f << '\n'; else std::cout << "failed to parse\n"; } { char const* s = "4294967296", *const e = s + std::strlen(s); std::cout << "=== extract_uint ===\n"; std::cout << "input: " << s << '\n'; boost::uint32_t ul; boost::spirit::qi::extract_uint<boost::uint32_t, 10, 1, -1, false, true>::call(s, e, ul); std::cout << "result: " << ul << '\n'; std::cout << "at end: " << std::boolalpha << (s == e) << '\n'; std::cout << "chars left: " << (e - s) << '\n'; } }
Output:
=== float_ === input: 0.4294967296 result: 4.29497 expected: 0.429497 === extract_uint === input: 4294967296 result: 4294967290 at end: false chars left: 1
https://wandbox.org/permlink/chIdPnbDOtS5FUat
The text was updated successfully, but these errors were encountered:
That's a very bad bug! How did the tests not catch that :-( ? Do you have a fix?
Sorry, something went wrong.
Ah because IgnoreOverflowDigits is normally false (default) which the int parsers use.
Yes I have a fix Kojoley@3dc361a but I want to benchmark it before firing a PR.
Wonderful! Please add the test case.
No branches or pull requests
There is a bug either in
extract_uint
or real parser.From my point of view the bug is in
extract_uint
because:IgnoreOverflowDigits
was added in the same commit as it usage in real parser 6832dc24294967296
either should result in429496729
or4294967290
but the iterator must be incremented.Output:
https://wandbox.org/permlink/chIdPnbDOtS5FUat
The text was updated successfully, but these errors were encountered: