diff options
author | Marc Glisse <marc.glisse@normalesup.org> | 2011-03-02 15:06:00 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-03-02 15:06:00 +0000 |
commit | a7443a2dd6d766cfe829d89b62e3aeb6a490fc50 (patch) | |
tree | f899a8f1f168d4604e8f9303d61da89ff139c751 /libstdc++-v3 | |
parent | 8fddbce4ab902f855472c30dd1c8bb713854e3c4 (diff) | |
download | gcc-a7443a2dd6d766cfe829d89b62e3aeb6a490fc50.zip gcc-a7443a2dd6d766cfe829d89b62e3aeb6a490fc50.tar.gz gcc-a7443a2dd6d766cfe829d89b62e3aeb6a490fc50.tar.bz2 |
ratio (ratio_less): Add comments.
2011-03-02 Marc Glisse <marc.glisse@normalesup.org>
* include/std/ratio (ratio_less): Add comments.
From-SVN: r170617
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/std/ratio | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c2c86d6..66786f4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2011-03-02 Marc Glisse <marc.glisse@normalesup.org> + * include/std/ratio (ratio_less): Add comments. + +2011-03-02 Marc Glisse <marc.glisse@normalesup.org> + PR libstdc++/47913 * include/std/ratio (ratio_add): Avoid denominator overflow. * testsuite/20_util/ratio/operations/47913.cc: New. diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio index 30bce16..17d28a1 100644 --- a/libstdc++-v3/include/std/ratio +++ b/libstdc++-v3/include/std/ratio @@ -279,10 +279,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; // 0 <= _Ri < 1 + // If one is 0, conclude + // Otherwise, x < y iff 1/y < 1/x template<typename _R1, typename _R2> struct __ratio_less_impl_2; // _Ri > 0 + // Compare the integral parts, and remove them if they are equal template<typename _R1, typename _R2, intmax_t __q1 = _R1::num / _R1::den, intmax_t __q2 = _R2::num / _R2::den, bool __eq = (__q1 == __q2)> struct __ratio_less_impl_1 @@ -338,6 +341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// ratio_less + // using a continued fraction expansion template<typename _R1, typename _R2> struct ratio_less : __ratio_less_impl<_R1, _R2>::type |