tmp/tmp2dvogc3g/{from.md → to.md}
RENAMED
|
@@ -5,21 +5,23 @@ namespace std {
|
|
| 5 |
template <intmax_t N, intmax_t D = 1>
|
| 6 |
class ratio {
|
| 7 |
public:
|
| 8 |
static constexpr intmax_t num;
|
| 9 |
static constexpr intmax_t den;
|
| 10 |
-
|
| 11 |
};
|
| 12 |
}
|
| 13 |
```
|
| 14 |
|
| 15 |
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 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
The static data members `num` and `den` shall have the following values,
|
| 23 |
where `gcd` represents the greatest common divisor of the absolute
|
| 24 |
values of `N` and `D`:
|
| 25 |
|
|
|
|
| 5 |
template <intmax_t N, intmax_t D = 1>
|
| 6 |
class ratio {
|
| 7 |
public:
|
| 8 |
static constexpr intmax_t num;
|
| 9 |
static constexpr intmax_t den;
|
| 10 |
+
using type = ratio<num, den>;
|
| 11 |
};
|
| 12 |
}
|
| 13 |
```
|
| 14 |
|
| 15 |
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. In a two’s complement representation,
|
| 22 |
+
this excludes the most negative value. — *end note*]
|
| 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 |
|