This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/78975] New: uniform_real_distribution should not check RealType with is_floating_point


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78975

            Bug ID: 78975
           Summary: uniform_real_distribution should not check RealType
                    with is_floating_point
           Product: gcc
           Version: 6.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: charles at karney dot com
  Target Milestone: ---

random's uniform_real_distribution checks the its template argument with
is_floating_point.  This means it can't be used with high-precision
types such as boost::multiprecision::float128.  See 

  https://svn.boost.org/trac/boost/ticket/12720

John Maddock (the maintainer of the boost multiprecision libraries) says
that, because float128 qualifies as is_class it's not possible for it
also to be is_float_point.  On the other hand, numeric_limits can (and
is) specialized for float128.  So I'd like to request that the tests in
uniform_real_distribution and other real distributions be changed from

  static_assert(std::is_floating_point<_RealType>::value,
                "template argument not a floating point type");

to something like

  static_assert(std::numeric_limits<_RealType>::is_specialised &&
                !std::numeric_limits<_RealType>::is_integer,
               "template argument not a floating point type");

Thanks!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]