tmp/tmpy2gtm3h0/{from.md → to.md}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
### Class template `ratio` <a id="ratio.ratio">[[ratio.ratio]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
-
template
|
| 6 |
-
class ratio {
|
| 7 |
public:
|
| 8 |
static constexpr intmax_t num;
|
| 9 |
static constexpr intmax_t den;
|
| 10 |
using type = ratio<num, den>;
|
| 11 |
};
|
|
@@ -16,12 +15,12 @@ If the template argument `D` is zero or the absolute values of either of
|
|
| 16 |
the template arguments `N` and `D` is not representable by type
|
| 17 |
`intmax_t`, the program is ill-formed.
|
| 18 |
|
| 19 |
[*Note 1*: These rules ensure that infinite ratios are avoided and that
|
| 20 |
for any negative input, there exists a representable value of its
|
| 21 |
-
absolute value which is positive.
|
| 22 |
-
|
| 23 |
|
| 24 |
The static data members `num` and `den` shall have the following values,
|
| 25 |
where `gcd` represents the greatest common divisor of the absolute
|
| 26 |
values of `N` and `D`:
|
| 27 |
|
|
|
|
| 1 |
### Class template `ratio` <a id="ratio.ratio">[[ratio.ratio]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
+
template<intmax_t N, intmax_t D = 1> class ratio {
|
|
|
|
| 6 |
public:
|
| 7 |
static constexpr intmax_t num;
|
| 8 |
static constexpr intmax_t den;
|
| 9 |
using type = ratio<num, den>;
|
| 10 |
};
|
|
|
|
| 15 |
the template arguments `N` and `D` is not representable by type
|
| 16 |
`intmax_t`, the program is ill-formed.
|
| 17 |
|
| 18 |
[*Note 1*: These rules ensure that infinite ratios are avoided and that
|
| 19 |
for any negative input, there exists a representable value of its
|
| 20 |
+
absolute value which is positive. This excludes the most negative
|
| 21 |
+
value. — *end note*]
|
| 22 |
|
| 23 |
The static data members `num` and `den` shall have the following values,
|
| 24 |
where `gcd` represents the greatest common divisor of the absolute
|
| 25 |
values of `N` and `D`:
|
| 26 |
|