lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 3f177433 6/6: Assert a precondition


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 3f177433 6/6: Assert a precondition
Date: Tue, 21 Feb 2023 13:13:19 -0500 (EST)

branch: master
commit 3f1774331e68069cddf3792214fd923bcb684f3d
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Assert a precondition
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2023-02/msg00018.html
---
 bourn_cast_test.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 3de00bb1..f2bfaf06 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -54,6 +54,7 @@ inline To bourn_cast(From from)
 #include "test_tools.hpp"
 #include "timer.hpp"
 
+#include <cfloat>                       // LDBL_MANT_DIG
 #include <climits>                      // INT_MIN, LLONG_MIN, SCHAR_MIN
 #include <cmath>                        // isnormal(), nextafterf()
 
@@ -82,7 +83,7 @@ void test_same(char const* file, int line)
     // an 80-bit long double type whose 64-bit mantissa suffices to
     // test the limits of every integral type up to 64 digits exactly
     // because it can distinguish +/-(2^64) from +/-(2^64 - 1).
-    if(traits::is_integer)
+    if(traits::is_integer && 64 <= LDBL_MANT_DIG)
         {
         long double const x = std::scalbln(1.0l, traits::digits);
         long double const max = x - 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]