
<snip>
What I can't figure out, though, is if a floating-point
type actually *should* round-trip back from a string in scientific format with (max_digits10 + 1) precision.
Wait, you are right. And I finally have to solve this problem correctly! Paul Bristow and I wiere beginning to identify this problem last year. But I did not identify what may be the right solution. (See below.) <snip>
I'm not sure I follow you - what the std says is: static constexpr int digits10; 11 Number of base 10 digits that can be represented without change. 12 Meaningful for all specializations in which is_bounded != false.
Could you please tell me where this is in ISO 14882:2011? I can't find it. <snip>
Which I take as meaning that if you print at least max_digits10 digits then you should always be able to get back to the same unique value.
I agree. <snip>
Oh wait.... just looked at the code and I see the issue - you set max_digits10 to digits10+1 which isn't enough, should be set to cpp_dec_float_total_digits10 which is the largest number of digits possible in the number right? Making that change causes the test to pass, so committing, but please advise if that's upping max_digits10 too far ;-) Cheers, John.
Wait John. It took me a long time to finally figure this out. And it gets back to some of our original work with Paul Bristow. I believe that we actually need to test for equality to within 1ULP, whereby the ULP in this case is the least significant, potentially rounded and carried base-10 "digit" in the limb containing the ULP of least precision in cpp_dec_float. I need to actually add more intelligence to template <unsigned Digits10> int cpp_dec_float<Digits10>::cmp_data(const array_type& vd) const. The current equality case includes *all* the guard limbs, even though some are insignificant. I need to analyze the real number of identical base-10 digits in LHS and RHS, take rounding into account and test for equality not until the end of the limbs, but until one max_digits10, potentially rounded and carried from (max_digits10 + 1). Can you follow me? Do you agree with this? It shouldn't be too difficult to implement and I don't anticipate significant performance loss due to analyzing two limbs in the array in base-10, possibly in conjunction with lexical conversion. And I would really like to give this a try. With your permission, may I try this? Am I on the right track? I believe that we are getting cpp_dec_float to behave very much like a built-in type. I know I keep adding more time to the development cycle. But I feel that we are still discovering improvements. In my opinion, we are getting close. Best regards, Chris.