[libcxx] r289029 - Fix PR30323: numeric_limits<T>::max_digits10 when using 16 bit ints.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 23:30:02 PST 2016


Author: ericwf
Date: Thu Dec  8 01:30:01 2016
New Revision: 289029

URL: http://llvm.org/viewvc/llvm-project?rev=289029&view=rev
Log:
Fix PR30323: numeric_limits<T>::max_digits10 when using 16 bit ints.

Summary: Also see https://llvm.org/bugs/show_bug.cgi?id=30323

Reviewers: mclow.lists

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27566

Modified:
    libcxx/trunk/include/limits

Modified: libcxx/trunk/include/limits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits?rev=289029&r1=289028&r2=289029&view=diff
==============================================================================
--- libcxx/trunk/include/limits (original)
+++ libcxx/trunk/include/limits Thu Dec  8 01:30:01 2016
@@ -306,7 +306,7 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_signed = true;
     static _LIBCPP_CONSTEXPR const int  digits = __FLT_MANT_DIG__;
     static _LIBCPP_CONSTEXPR const int  digits10 = __FLT_DIG__;
-    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103)/100000;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103l)/100000l;
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
@@ -352,7 +352,7 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_signed = true;
     static _LIBCPP_CONSTEXPR const int  digits = __DBL_MANT_DIG__;
     static _LIBCPP_CONSTEXPR const int  digits10 = __DBL_DIG__;
-    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103)/100000;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103l)/100000l;
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
@@ -398,7 +398,7 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_signed = true;
     static _LIBCPP_CONSTEXPR const int  digits = __LDBL_MANT_DIG__;
     static _LIBCPP_CONSTEXPR const int  digits10 = __LDBL_DIG__;
-    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103)/100000;
+    static _LIBCPP_CONSTEXPR const int  max_digits10 = 2+(digits * 30103l)/100000l;
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}




More information about the cfe-commits mailing list