Boost logo

Boost :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2025-01-18 20:10:57


On 18/01/2025 17:56, Peter Dimov via Boost 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.
Indeed, this would be perfect for that!
>
> 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