[libcxx-commits] [libcxx] r364798 - Fix -Wdouble-promotion warnings.

Bruce Mitchener via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 1 09:13:31 PDT 2019


Author: brucem
Date: Mon Jul  1 09:13:31 2019
New Revision: 364798

URL: http://llvm.org/viewvc/llvm-project?rev=364798&view=rev
Log:
Fix -Wdouble-promotion warnings.

Reviewers: mclow.lists

Subscribers: christof, ldionne, cfe-commits, libcxx-commits

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

Modified:
    libcxx/trunk/include/limits
    libcxx/trunk/include/utility

Modified: libcxx/trunk/include/limits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits?rev=364798&r1=364797&r2=364798&view=diff
==============================================================================
--- libcxx/trunk/include/limits (original)
+++ libcxx/trunk/include/limits Mon Jul  1 09:13:31 2019
@@ -409,7 +409,7 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_exact = false;
     static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
-    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
 
     static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
     static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;

Modified: libcxx/trunk/include/utility
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=364798&r1=364797&r2=364798&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Mon Jul  1 09:13:31 2019
@@ -1479,7 +1479,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<float>
     size_t operator()(float __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-       if (__v == 0.0)
+       if (__v == 0.0f)
            return 0;
         return __scalar_hash<float>::operator()(__v);
     }
@@ -1507,7 +1507,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long do
     size_t operator()(long double __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-        if (__v == 0.0)
+        if (__v == 0.0L)
             return 0;
 #if defined(__i386__)
         // Zero out padding bits




More information about the libcxx-commits mailing list