tmp/tmp60lnxd9k/{from.md → to.md}
RENAMED
|
@@ -13,10 +13,11 @@ or `R2`, and the template argument is not a specialization of the
|
|
| 13 |
`ratio` template, the program is ill-formed.
|
| 14 |
|
| 15 |
### Header `<ratio>` synopsis <a id="ratio.syn">[[ratio.syn]]</a>
|
| 16 |
|
| 17 |
``` cpp
|
|
|
|
| 18 |
namespace std {
|
| 19 |
// [ratio.ratio], class template ratio
|
| 20 |
template<intmax_t N, intmax_t D = 1> class ratio;
|
| 21 |
|
| 22 |
// [ratio.arithmetic], ratio arithmetic
|
|
@@ -32,21 +33,21 @@ namespace std {
|
|
| 32 |
template<class R1, class R2> struct ratio_less_equal;
|
| 33 |
template<class R1, class R2> struct ratio_greater;
|
| 34 |
template<class R1, class R2> struct ratio_greater_equal;
|
| 35 |
|
| 36 |
template<class R1, class R2>
|
| 37 |
-
|
| 38 |
template<class R1, class R2>
|
| 39 |
-
|
| 40 |
template<class R1, class R2>
|
| 41 |
-
|
| 42 |
template<class R1, class R2>
|
| 43 |
-
|
| 44 |
template<class R1, class R2>
|
| 45 |
-
|
| 46 |
template<class R1, class R2>
|
| 47 |
-
|
| 48 |
|
| 49 |
// [ratio.si], convenience SI typedefs
|
| 50 |
using yocto = ratio<1, 1'000'000'000'000'000'000'000'000>; // see below
|
| 51 |
using zepto = ratio<1, 1'000'000'000'000'000'000'000>; // see below
|
| 52 |
using atto = ratio<1, 1'000'000'000'000'000'000>;
|
|
@@ -94,11 +95,12 @@ value. — *end note*]
|
|
| 94 |
|
| 95 |
The static data members `num` and `den` shall have the following values,
|
| 96 |
where `gcd` represents the greatest common divisor of the absolute
|
| 97 |
values of `N` and `D`:
|
| 98 |
|
| 99 |
-
- `num` shall have the value
|
|
|
|
| 100 |
- `den` shall have the value `abs(D) / gcd`.
|
| 101 |
|
| 102 |
### Arithmetic on `ratio`s <a id="ratio.arithmetic">[[ratio.arithmetic]]</a>
|
| 103 |
|
| 104 |
Each of the alias templates `ratio_add`, `ratio_subtract`,
|
|
@@ -191,5 +193,83 @@ template<class R1, class R2>
|
|
| 191 |
For each of the *typedef-name*s `yocto`, `zepto`, `zetta`, and `yotta`,
|
| 192 |
if both of the constants used in its specification are representable by
|
| 193 |
`intmax_t`, the typedef is defined; if either of the constants is not
|
| 194 |
representable by `intmax_t`, the typedef is not defined.
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
`ratio` template, the program is ill-formed.
|
| 14 |
|
| 15 |
### Header `<ratio>` synopsis <a id="ratio.syn">[[ratio.syn]]</a>
|
| 16 |
|
| 17 |
``` cpp
|
| 18 |
+
// all freestanding
|
| 19 |
namespace std {
|
| 20 |
// [ratio.ratio], class template ratio
|
| 21 |
template<intmax_t N, intmax_t D = 1> class ratio;
|
| 22 |
|
| 23 |
// [ratio.arithmetic], ratio arithmetic
|
|
|
|
| 33 |
template<class R1, class R2> struct ratio_less_equal;
|
| 34 |
template<class R1, class R2> struct ratio_greater;
|
| 35 |
template<class R1, class R2> struct ratio_greater_equal;
|
| 36 |
|
| 37 |
template<class R1, class R2>
|
| 38 |
+
constexpr bool ratio_equal_v = ratio_equal<R1, R2>::value;
|
| 39 |
template<class R1, class R2>
|
| 40 |
+
constexpr bool ratio_not_equal_v = ratio_not_equal<R1, R2>::value;
|
| 41 |
template<class R1, class R2>
|
| 42 |
+
constexpr bool ratio_less_v = ratio_less<R1, R2>::value;
|
| 43 |
template<class R1, class R2>
|
| 44 |
+
constexpr bool ratio_less_equal_v = ratio_less_equal<R1, R2>::value;
|
| 45 |
template<class R1, class R2>
|
| 46 |
+
constexpr bool ratio_greater_v = ratio_greater<R1, R2>::value;
|
| 47 |
template<class R1, class R2>
|
| 48 |
+
constexpr bool ratio_greater_equal_v = ratio_greater_equal<R1, R2>::value;
|
| 49 |
|
| 50 |
// [ratio.si], convenience SI typedefs
|
| 51 |
using yocto = ratio<1, 1'000'000'000'000'000'000'000'000>; // see below
|
| 52 |
using zepto = ratio<1, 1'000'000'000'000'000'000'000>; // see below
|
| 53 |
using atto = ratio<1, 1'000'000'000'000'000'000>;
|
|
|
|
| 95 |
|
| 96 |
The static data members `num` and `den` shall have the following values,
|
| 97 |
where `gcd` represents the greatest common divisor of the absolute
|
| 98 |
values of `N` and `D`:
|
| 99 |
|
| 100 |
+
- `num` shall have the value
|
| 101 |
+
`\operatorname{sgn}(N) * \operatorname{sgn}(D) * abs(N) / gcd`.
|
| 102 |
- `den` shall have the value `abs(D) / gcd`.
|
| 103 |
|
| 104 |
### Arithmetic on `ratio`s <a id="ratio.arithmetic">[[ratio.arithmetic]]</a>
|
| 105 |
|
| 106 |
Each of the alias templates `ratio_add`, `ratio_subtract`,
|
|
|
|
| 193 |
For each of the *typedef-name*s `yocto`, `zepto`, `zetta`, and `yotta`,
|
| 194 |
if both of the constants used in its specification are representable by
|
| 195 |
`intmax_t`, the typedef is defined; if either of the constants is not
|
| 196 |
representable by `intmax_t`, the typedef is not defined.
|
| 197 |
|
| 198 |
+
<!-- Link reference definitions -->
|
| 199 |
+
[array]: containers.md#array
|
| 200 |
+
[basic.compound]: basic.md#basic.compound
|
| 201 |
+
[basic.fundamental]: basic.md#basic.fundamental
|
| 202 |
+
[basic.type.qualifier]: basic.md#basic.type.qualifier
|
| 203 |
+
[basic.types]: basic.md#basic.types
|
| 204 |
+
[basic.types.general]: basic.md#basic.types.general
|
| 205 |
+
[class.abstract]: class.md#class.abstract
|
| 206 |
+
[class.derived]: class.md#class.derived
|
| 207 |
+
[class.dtor]: class.md#class.dtor
|
| 208 |
+
[class.mem]: class.md#class.mem
|
| 209 |
+
[class.pre]: class.md#class.pre
|
| 210 |
+
[class.prop]: class.md#class.prop
|
| 211 |
+
[class.temporary]: basic.md#class.temporary
|
| 212 |
+
[class.virtual]: class.md#class.virtual
|
| 213 |
+
[conv.rank]: basic.md#conv.rank
|
| 214 |
+
[dcl.array]: dcl.md#dcl.array
|
| 215 |
+
[dcl.enum]: dcl.md#dcl.enum
|
| 216 |
+
[dcl.init.aggr]: dcl.md#dcl.init.aggr
|
| 217 |
+
[dcl.ref]: dcl.md#dcl.ref
|
| 218 |
+
[declval]: utilities.md#declval
|
| 219 |
+
[defns.referenceable]: intro.md#defns.referenceable
|
| 220 |
+
[expr.alignof]: expr.md#expr.alignof
|
| 221 |
+
[expr.type]: expr.md#expr.type
|
| 222 |
+
[expr.unary.noexcept]: expr.md#expr.unary.noexcept
|
| 223 |
+
[func.require]: utilities.md#func.require
|
| 224 |
+
[functional.syn]: utilities.md#functional.syn
|
| 225 |
+
[intseq]: #intseq
|
| 226 |
+
[intseq.general]: #intseq.general
|
| 227 |
+
[intseq.intseq]: #intseq.intseq
|
| 228 |
+
[intseq.make]: #intseq.make
|
| 229 |
+
[meta]: #meta
|
| 230 |
+
[meta.const.eval]: #meta.const.eval
|
| 231 |
+
[meta.general]: #meta.general
|
| 232 |
+
[meta.help]: #meta.help
|
| 233 |
+
[meta.logical]: #meta.logical
|
| 234 |
+
[meta.member]: #meta.member
|
| 235 |
+
[meta.rel]: #meta.rel
|
| 236 |
+
[meta.rqmts]: #meta.rqmts
|
| 237 |
+
[meta.summary]: #meta.summary
|
| 238 |
+
[meta.trans]: #meta.trans
|
| 239 |
+
[meta.trans.arr]: #meta.trans.arr
|
| 240 |
+
[meta.trans.cv]: #meta.trans.cv
|
| 241 |
+
[meta.trans.general]: #meta.trans.general
|
| 242 |
+
[meta.trans.other]: #meta.trans.other
|
| 243 |
+
[meta.trans.ptr]: #meta.trans.ptr
|
| 244 |
+
[meta.trans.ref]: #meta.trans.ref
|
| 245 |
+
[meta.trans.sign]: #meta.trans.sign
|
| 246 |
+
[meta.type.synop]: #meta.type.synop
|
| 247 |
+
[meta.unary]: #meta.unary
|
| 248 |
+
[meta.unary.cat]: #meta.unary.cat
|
| 249 |
+
[meta.unary.comp]: #meta.unary.comp
|
| 250 |
+
[meta.unary.general]: #meta.unary.general
|
| 251 |
+
[meta.unary.prop]: #meta.unary.prop
|
| 252 |
+
[meta.unary.prop.query]: #meta.unary.prop.query
|
| 253 |
+
[namespace.std]: library.md#namespace.std
|
| 254 |
+
[ratio]: #ratio
|
| 255 |
+
[ratio.arithmetic]: #ratio.arithmetic
|
| 256 |
+
[ratio.comparison]: #ratio.comparison
|
| 257 |
+
[ratio.general]: #ratio.general
|
| 258 |
+
[ratio.ratio]: #ratio.ratio
|
| 259 |
+
[ratio.si]: #ratio.si
|
| 260 |
+
[ratio.syn]: #ratio.syn
|
| 261 |
+
[special]: class.md#special
|
| 262 |
+
[stmt.return]: stmt.md#stmt.return
|
| 263 |
+
[support.signal]: support.md#support.signal
|
| 264 |
+
[swappable.requirements]: library.md#swappable.requirements
|
| 265 |
+
[term.layout.compatible.type]: basic.md#term.layout.compatible.type
|
| 266 |
+
[term.object.type]: basic.md#term.object.type
|
| 267 |
+
[term.odr.use]: basic.md#term.odr.use
|
| 268 |
+
[term.scalar.type]: basic.md#term.scalar.type
|
| 269 |
+
[term.standard.layout.type]: basic.md#term.standard.layout.type
|
| 270 |
+
[term.trivial.type]: basic.md#term.trivial.type
|
| 271 |
+
[term.trivially.copyable.type]: basic.md#term.trivially.copyable.type
|
| 272 |
+
[term.unevaluated.operand]: expr.md#term.unevaluated.operand
|
| 273 |
+
[tuple.apply]: utilities.md#tuple.apply
|
| 274 |
+
[type.traits]: #type.traits
|
| 275 |
+
[type.traits.general]: #type.traits.general
|