|
Boost : |
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2025-01-18 20:19:24
>>Â Rubin's point was that if you have a literal such as
>>
>> 1.2345678912345678_DD
>>
>> Then the type computed is a decimal64 and the result will be rounded to
>> 16 decimal places. This is true regardless of whether it is subsequently
>> static_cast to something else (potentially causing double rounding).
>>
>> So... I'm *reasonably* sure that Chris's argument doesn't hold so much water.
Agreed.
Yes. I do think, however, we all kind of wound upfiguring this out. My original argumentation mighthave been off.
Maybe intuitively I sensed the "users will get frustrated"part. So we are all on the same page now.
> But, I do see one argument against a compile time assert, which is the "this is a> right pain in the butt" argument, basically that users may not want to be
> forced to round all the arguments themselves, and/or that this may be error
> prone: have you counted exactly 16 digits and not accidentally rounded to
> 15? Plus string streaming will presumably round excess digits so it kind of
> makes sense to be consistent.
My advice remains the same. Do not botherour clients by forcing them to create their ownexact representations for tables, exact valuesin subroutines and the like. This would lead toa higher level of client dissatisfaction overall.
Thanks Ruben, thanks John, I think in my/ourroundabout way, we figured this out.
- Chris
On Saturday, January 18, 2025 at 06:57:10 PM GMT+1, Peter Dimov via Boost <boost_at_[hidden]> wrote:
John Maddock wrote:
> Chris, Rubin, I *think* you are somewhat talking about different things here...
>
> Rubin's point was that if you have a literal such as
>
> 1.2345678912345678_DD
>
> Then the type computed is a decimal64 and the result will be rounded to
> 16 decimal places. This is true regardless of whether it is subsequently
> static_cast to something else (potentially causing double rounding).
>
> So... I'm *reasonably* sure that Chris's argument doesn't hold so much water.
>
> But, I do see one argument against a compile time assert, which is the "this is a
> right pain in the butt" argument, basically that users may not want to be
> forced to round all the arguments themselves, and/or that this may be error
> prone: have you counted exactly 16 digits and not accidentally rounded to
> 15? Plus string streaming will presumably round excess digits so it kind of
> makes sense to be consistent.
A better option than failing here is probably to issue a warning, but
constexpr_warn_str is still years away.
https://isocpp.org/files/papers/P2758R4.html
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk