public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
@ 2010-10-02 12:08 kalven at gmail dot com
  2010-10-02 12:40 ` [Bug libstdc++/45866] [C++0x] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kalven at gmail dot com @ 2010-10-02 12:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

           Summary: std::ratio_add, ratio_sub, ratio_multiply,
                    ratio_divide do not have num and den members.
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kalven@gmail.com


The latest C++ draft (which I think is n3126) says this about ratio_add:

"The type ratio_add<R1, R2> shall be a synonym for ratio<T1, T2> where T1 has
the value R1::num * R2::den + R2::num * R1::den and T2 has the value R1::den *
R2::den."

The current implementation in libstdc++ is:

  template<typename _R1, typename _R2>
    struct ratio_add
    {
    private:
      static const intmax_t __gcd =
        __static_gcd<_R1::den, _R2::den>::value;

    public:
      typedef ratio<
        __safe_add<
          __safe_multiply<_R1::num, (_R2::den / __gcd)>::value,
          __safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value,
        __safe_multiply<_R1::den, (_R2::den / __gcd)>::value> type;
    };

Which places the result in a nested type. I interpret the wording of the
standard to mean that ratio_add<R1, R2> should have the static members num and
den.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/45866] [C++0x] std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
  2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
@ 2010-10-02 12:40 ` redi at gcc dot gnu.org
  2010-10-02 12:43 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-02 12:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.02 12:40:19
            Summary|std::ratio_add, ratio_sub,  |[C++0x] std::ratio_add,
                   |ratio_multiply,             |ratio_sub, ratio_multiply,
                   |ratio_divide do not have    |ratio_divide do not have
                   |num and den members.        |num and den members.
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-02 12:40:19 UTC ---
We currently implement the spec from n3035, the definitions changed in n3090


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/45866] [C++0x] std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
  2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
  2010-10-02 12:40 ` [Bug libstdc++/45866] [C++0x] " redi at gcc dot gnu.org
@ 2010-10-02 12:43 ` redi at gcc dot gnu.org
  2010-10-18 16:35 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-02 12:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |45114

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-02 12:43:38 UTC ---
It's not possible to implement the new spec without template aliases, so this
PR depends on PR c++/45114


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/45866] [C++0x] std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
  2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
  2010-10-02 12:40 ` [Bug libstdc++/45866] [C++0x] " redi at gcc dot gnu.org
  2010-10-02 12:43 ` redi at gcc dot gnu.org
@ 2010-10-18 16:35 ` paolo.carlini at oracle dot com
  2010-10-18 16:36 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-18 16:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-18 16:35:45 UTC ---
I don't see c++/45114 resolved very soon, thus, for 4.6.0, let's provide anyway
those constants, seems simple.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/45866] [C++0x] std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
  2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
                   ` (2 preceding siblings ...)
  2010-10-18 16:35 ` paolo.carlini at oracle dot com
@ 2010-10-18 16:36 ` paolo.carlini at oracle dot com
  2010-10-18 17:28 ` paolo at gcc dot gnu.org
  2010-10-18 17:30 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-18 16:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/45866] [C++0x] std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
  2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
                   ` (3 preceding siblings ...)
  2010-10-18 16:36 ` paolo.carlini at oracle dot com
@ 2010-10-18 17:28 ` paolo at gcc dot gnu.org
  2010-10-18 17:30 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2010-10-18 17:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2010-10-18 17:28:21 UTC ---
Author: paolo
Date: Mon Oct 18 17:28:15 2010
New Revision: 165649

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165649
Log:
2010-10-18  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/45866
    * include/std/ratio (ratio<>::type): Add.
    (ratio_add<>::num, ratio_add<>::den,
    ratio_subtract<>::num, ratio_subtract<>::den,
    ratio_multiply<>::num, ratio_multiply<>::den,
    ratio_divide<>::num, ratio_divide<>::den): Likewise.
    * testsuite/20_util/ratio/operations/45866.cc: New.


Added:
    trunk/libstdc++-v3/testsuite/20_util/ratio/operations/45866.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/ratio


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/45866] [C++0x] std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members.
  2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
                   ` (4 preceding siblings ...)
  2010-10-18 17:28 ` paolo at gcc dot gnu.org
@ 2010-10-18 17:30 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-18 17:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45866

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-18 17:30:05 UTC ---
Done.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-18 17:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-02 12:08 [Bug libstdc++/45866] New: std::ratio_add, ratio_sub, ratio_multiply, ratio_divide do not have num and den members kalven at gmail dot com
2010-10-02 12:40 ` [Bug libstdc++/45866] [C++0x] " redi at gcc dot gnu.org
2010-10-02 12:43 ` redi at gcc dot gnu.org
2010-10-18 16:35 ` paolo.carlini at oracle dot com
2010-10-18 16:36 ` paolo.carlini at oracle dot com
2010-10-18 17:28 ` paolo at gcc dot gnu.org
2010-10-18 17:30 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).