This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [v3] c++0x std::ratio implementation


Hi,

> I should also mention that the restriction of the range is due
> to > 20.3.1 paragraph 1: "the absolute value of the template arguments
> N and D shall be representable by type intmax_t". Since
> abs(INTMAX_MIN) == INTMAX_MAX + 1, a diagnostic is issued if N/D == INTMAX_MIN.

Right. Now I studied carefully the specifications and indeed everything is easy ;)

The below is going in. A few not completely trivial changes:

1- Added missing definitions of ratio<>::num and ratio<>::den.
2- Adjusted the computation of __c in __safe_multiply: 1ul was not safe for 32bit machines.
3- Adjusted the testcases: as do-run tests you cannot ifdef out the main completely ;)

Thanks again,
Paolo.

Attachment: CL_ratio.txt
Description: Text document

Attachment: patch_ratio.txt
Description: Text document


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