Page 1 of 1

C ++-23 numeric_limits :: max () Anwendungsfall

Posted: 02 May 2025, 08:51
by Anonymous
Befolgen Sie die Diskussion in C ++ Long Double (128-Bit) Genauigkeit, was ist der Anwendungsfall von numeric_limits :: max () ? Wie kann ich dieser Konstante vertrauen, beispielsweise bei der Überprüfung des Bereichs/Überlauffehlers?

Code: Select all

    feclearexcept(FE_INEXACT);
long double ld = 1.0L;
for (size_t i = 2; ld < numeric_limits::max(); i++)
{
long double ld1 = ld * i;
if (fetestexcept(FE_INEXACT))
{
cout