tmp/tmpc6p0co92/{from.md → to.md}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
## Compile-time rational arithmetic <a id="ratio">[[ratio]]</a>
|
| 2 |
|
| 3 |
-
###
|
| 4 |
|
| 5 |
Subclause [[ratio]] describes the ratio library. It provides a class
|
| 6 |
template `ratio` which exactly represents any finite rational number
|
| 7 |
with a numerator and denominator representable by compile-time constants
|
| 8 |
of type `intmax_t`.
|
|
@@ -46,10 +46,12 @@ namespace std {
|
|
| 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>;
|
| 54 |
using femto = ratio<1, 1'000'000'000'000'000>;
|
| 55 |
using pico = ratio<1, 1'000'000'000'000>;
|
|
@@ -66,10 +68,12 @@ namespace std {
|
|
| 66 |
using tera = ratio< 1'000'000'000'000, 1>;
|
| 67 |
using peta = ratio< 1'000'000'000'000'000, 1>;
|
| 68 |
using exa = ratio< 1'000'000'000'000'000'000, 1>;
|
| 69 |
using zetta = ratio< 1'000'000'000'000'000'000'000, 1>; // see below
|
| 70 |
using yotta = ratio< 1'000'000'000'000'000'000'000'000, 1>; // see below
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
```
|
| 73 |
|
| 74 |
### Class template `ratio` <a id="ratio.ratio">[[ratio.ratio]]</a>
|
| 75 |
|
|
@@ -188,55 +192,105 @@ template<class R1, class R2>
|
|
| 188 |
struct ratio_greater_equal : bool_constant<!ratio_less_v<R1, R2>> { };
|
| 189 |
```
|
| 190 |
|
| 191 |
### SI types for `ratio` <a id="ratio.si">[[ratio.si]]</a>
|
| 192 |
|
| 193 |
-
For each of the *typedef-name*s `
|
| 194 |
-
if both of the constants used
|
| 195 |
-
|
| 196 |
-
|
|
|
|
| 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.
|
|
|
|
| 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
|
|
@@ -249,10 +303,13 @@ representable by `intmax_t`, the typedef is not defined.
|
|
| 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
|
|
@@ -260,16 +317,25 @@ representable by `intmax_t`, the typedef is not defined.
|
|
| 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 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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]:
|
| 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
|
|
|
|
| 1 |
## Compile-time rational arithmetic <a id="ratio">[[ratio]]</a>
|
| 2 |
|
| 3 |
+
### General <a id="ratio.general">[[ratio.general]]</a>
|
| 4 |
|
| 5 |
Subclause [[ratio]] describes the ratio library. It provides a class
|
| 6 |
template `ratio` which exactly represents any finite rational number
|
| 7 |
with a numerator and denominator representable by compile-time constants
|
| 8 |
of type `intmax_t`.
|
|
|
|
| 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 quecto = ratio<1, 1'000'000'000'000'000'000'000'000'000'000>; // see below
|
| 52 |
+
using ronto = ratio<1, 1'000'000'000'000'000'000'000'000'000>; // see below
|
| 53 |
using yocto = ratio<1, 1'000'000'000'000'000'000'000'000>; // see below
|
| 54 |
using zepto = ratio<1, 1'000'000'000'000'000'000'000>; // see below
|
| 55 |
using atto = ratio<1, 1'000'000'000'000'000'000>;
|
| 56 |
using femto = ratio<1, 1'000'000'000'000'000>;
|
| 57 |
using pico = ratio<1, 1'000'000'000'000>;
|
|
|
|
| 68 |
using tera = ratio< 1'000'000'000'000, 1>;
|
| 69 |
using peta = ratio< 1'000'000'000'000'000, 1>;
|
| 70 |
using exa = ratio< 1'000'000'000'000'000'000, 1>;
|
| 71 |
using zetta = ratio< 1'000'000'000'000'000'000'000, 1>; // see below
|
| 72 |
using yotta = ratio< 1'000'000'000'000'000'000'000'000, 1>; // see below
|
| 73 |
+
using ronna = ratio< 1'000'000'000'000'000'000'000'000'000, 1>; // see below
|
| 74 |
+
using quetta = ratio<1'000'000'000'000'000'000'000'000'000'000, 1>; // see below
|
| 75 |
}
|
| 76 |
```
|
| 77 |
|
| 78 |
### Class template `ratio` <a id="ratio.ratio">[[ratio.ratio]]</a>
|
| 79 |
|
|
|
|
| 192 |
struct ratio_greater_equal : bool_constant<!ratio_less_v<R1, R2>> { };
|
| 193 |
```
|
| 194 |
|
| 195 |
### SI types for `ratio` <a id="ratio.si">[[ratio.si]]</a>
|
| 196 |
|
| 197 |
+
For each of the *typedef-name*s `quecto`, `ronto`, `yocto`, `zepto`,
|
| 198 |
+
`zetta`, `yotta`, `ronna`, and `quetta`, if both of the constants used
|
| 199 |
+
in its specification are representable by `intmax_t`, the typedef is
|
| 200 |
+
defined; if either of the constants is not representable by `intmax_t`,
|
| 201 |
+
the typedef is not defined.
|
| 202 |
|
| 203 |
<!-- Link reference definitions -->
|
| 204 |
[array]: containers.md#array
|
| 205 |
+
[basic.align]: basic.md#basic.align
|
| 206 |
[basic.compound]: basic.md#basic.compound
|
| 207 |
[basic.fundamental]: basic.md#basic.fundamental
|
| 208 |
+
[basic.life]: basic.md#basic.life
|
| 209 |
+
[basic.link]: basic.md#basic.link
|
| 210 |
+
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 211 |
+
[basic.scope.param]: basic.md#basic.scope.param
|
| 212 |
+
[basic.scope.scope]: basic.md#basic.scope.scope
|
| 213 |
+
[basic.stc]: basic.md#basic.stc
|
| 214 |
+
[basic.stc.general]: basic.md#basic.stc.general
|
| 215 |
[basic.type.qualifier]: basic.md#basic.type.qualifier
|
| 216 |
[basic.types]: basic.md#basic.types
|
| 217 |
[basic.types.general]: basic.md#basic.types.general
|
| 218 |
[class.abstract]: class.md#class.abstract
|
| 219 |
+
[class.access.base]: class.md#class.access.base
|
| 220 |
+
[class.conv.fct]: class.md#class.conv.fct
|
| 221 |
[class.dtor]: class.md#class.dtor
|
| 222 |
+
[class.inhctor.init]: class.md#class.inhctor.init
|
| 223 |
[class.mem]: class.md#class.mem
|
| 224 |
+
[class.mem.general]: class.md#class.mem.general
|
| 225 |
[class.pre]: class.md#class.pre
|
| 226 |
[class.prop]: class.md#class.prop
|
| 227 |
[class.temporary]: basic.md#class.temporary
|
| 228 |
+
[class.union.anon]: class.md#class.union.anon
|
| 229 |
[class.virtual]: class.md#class.virtual
|
| 230 |
+
[const.wrap.class]: #const.wrap.class
|
| 231 |
+
[conv.qual]: expr.md#conv.qual
|
| 232 |
[conv.rank]: basic.md#conv.rank
|
| 233 |
[dcl.array]: dcl.md#dcl.array
|
| 234 |
[dcl.enum]: dcl.md#dcl.enum
|
| 235 |
+
[dcl.fct]: dcl.md#dcl.fct
|
| 236 |
+
[dcl.fct.def.default]: dcl.md#dcl.fct.def.default
|
| 237 |
+
[dcl.fct.def.delete]: dcl.md#dcl.fct.def.delete
|
| 238 |
+
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 239 |
[dcl.init.aggr]: dcl.md#dcl.init.aggr
|
| 240 |
+
[dcl.link]: dcl.md#dcl.link
|
| 241 |
+
[dcl.pre]: dcl.md#dcl.pre
|
| 242 |
[dcl.ref]: dcl.md#dcl.ref
|
| 243 |
+
[dcl.typedef]: dcl.md#dcl.typedef
|
| 244 |
[declval]: utilities.md#declval
|
| 245 |
[defns.referenceable]: intro.md#defns.referenceable
|
| 246 |
+
[enum]: dcl.md#enum
|
| 247 |
+
[except.spec]: except.md#except.spec
|
| 248 |
[expr.alignof]: expr.md#expr.alignof
|
| 249 |
+
[expr.call]: expr.md#expr.call
|
| 250 |
+
[expr.const]: expr.md#expr.const
|
| 251 |
+
[expr.prim.lambda.closure]: expr.md#expr.prim.lambda.closure
|
| 252 |
+
[expr.prim.splice]: expr.md#expr.prim.splice
|
| 253 |
[expr.type]: expr.md#expr.type
|
| 254 |
[expr.unary.noexcept]: expr.md#expr.unary.noexcept
|
|
|
|
| 255 |
[functional.syn]: utilities.md#functional.syn
|
| 256 |
+
[intro.execution]: basic.md#intro.execution
|
| 257 |
+
[intro.object]: basic.md#intro.object
|
| 258 |
[intseq]: #intseq
|
| 259 |
[intseq.general]: #intseq.general
|
| 260 |
[intseq.intseq]: #intseq.intseq
|
| 261 |
[intseq.make]: #intseq.make
|
| 262 |
+
[lex.key]: lex.md#lex.key
|
| 263 |
+
[lex.name]: lex.md#lex.name
|
| 264 |
+
[lex.string]: lex.md#lex.string
|
| 265 |
[meta]: #meta
|
| 266 |
[meta.const.eval]: #meta.const.eval
|
| 267 |
+
[meta.define.static]: #meta.define.static
|
| 268 |
[meta.general]: #meta.general
|
| 269 |
[meta.help]: #meta.help
|
| 270 |
[meta.logical]: #meta.logical
|
| 271 |
[meta.member]: #meta.member
|
| 272 |
+
[meta.reflection]: #meta.reflection
|
| 273 |
+
[meta.reflection.access.context]: #meta.reflection.access.context
|
| 274 |
+
[meta.reflection.access.queries]: #meta.reflection.access.queries
|
| 275 |
+
[meta.reflection.annotation]: #meta.reflection.annotation
|
| 276 |
+
[meta.reflection.define.aggregate]: #meta.reflection.define.aggregate
|
| 277 |
+
[meta.reflection.exception]: #meta.reflection.exception
|
| 278 |
+
[meta.reflection.extract]: #meta.reflection.extract
|
| 279 |
+
[meta.reflection.layout]: #meta.reflection.layout
|
| 280 |
+
[meta.reflection.member.queries]: #meta.reflection.member.queries
|
| 281 |
+
[meta.reflection.names]: #meta.reflection.names
|
| 282 |
+
[meta.reflection.operators]: #meta.reflection.operators
|
| 283 |
+
[meta.reflection.queries]: #meta.reflection.queries
|
| 284 |
+
[meta.reflection.result]: #meta.reflection.result
|
| 285 |
+
[meta.reflection.substitute]: #meta.reflection.substitute
|
| 286 |
+
[meta.reflection.traits]: #meta.reflection.traits
|
| 287 |
[meta.rel]: #meta.rel
|
| 288 |
[meta.rqmts]: #meta.rqmts
|
| 289 |
+
[meta.string.literal]: #meta.string.literal
|
| 290 |
[meta.summary]: #meta.summary
|
| 291 |
+
[meta.syn]: #meta.syn
|
| 292 |
[meta.trans]: #meta.trans
|
| 293 |
[meta.trans.arr]: #meta.trans.arr
|
| 294 |
[meta.trans.cv]: #meta.trans.cv
|
| 295 |
[meta.trans.general]: #meta.trans.general
|
| 296 |
[meta.trans.other]: #meta.trans.other
|
|
|
|
| 303 |
[meta.unary.comp]: #meta.unary.comp
|
| 304 |
[meta.unary.general]: #meta.unary.general
|
| 305 |
[meta.unary.prop]: #meta.unary.prop
|
| 306 |
[meta.unary.prop.query]: #meta.unary.prop.query
|
| 307 |
[namespace.std]: library.md#namespace.std
|
| 308 |
+
[namespace.udecl]: dcl.md#namespace.udecl
|
| 309 |
+
[over.literal]: over.md#over.literal
|
| 310 |
+
[over.oper]: over.md#over.oper
|
| 311 |
[ratio]: #ratio
|
| 312 |
[ratio.arithmetic]: #ratio.arithmetic
|
| 313 |
[ratio.comparison]: #ratio.comparison
|
| 314 |
[ratio.general]: #ratio.general
|
| 315 |
[ratio.ratio]: #ratio.ratio
|
|
|
|
| 317 |
[ratio.syn]: #ratio.syn
|
| 318 |
[special]: class.md#special
|
| 319 |
[stmt.return]: stmt.md#stmt.return
|
| 320 |
[support.signal]: support.md#support.signal
|
| 321 |
[swappable.requirements]: library.md#swappable.requirements
|
| 322 |
+
[temp.arg]: temp.md#temp.arg
|
| 323 |
+
[temp.arg.nontype]: temp.md#temp.arg.nontype
|
| 324 |
+
[temp.dep.constexpr]: temp.md#temp.dep.constexpr
|
| 325 |
+
[temp.inst]: temp.md#temp.inst
|
| 326 |
+
[temp.names]: temp.md#temp.names
|
| 327 |
+
[temp.param]: temp.md#temp.param
|
| 328 |
+
[temp.pre]: temp.md#temp.pre
|
| 329 |
+
[temp.spec.partial]: temp.md#temp.spec.partial
|
| 330 |
+
[temp.type]: temp.md#temp.type
|
| 331 |
+
[term.implicit.lifetime.type]: basic.md#term.implicit.lifetime.type
|
| 332 |
[term.object.type]: basic.md#term.object.type
|
| 333 |
[term.odr.use]: basic.md#term.odr.use
|
| 334 |
[term.scalar.type]: basic.md#term.scalar.type
|
| 335 |
[term.standard.layout.type]: basic.md#term.standard.layout.type
|
| 336 |
+
[term.trivial.type]: future.md#term.trivial.type
|
| 337 |
[term.trivially.copyable.type]: basic.md#term.trivially.copyable.type
|
| 338 |
[term.unevaluated.operand]: expr.md#term.unevaluated.operand
|
| 339 |
[tuple.apply]: utilities.md#tuple.apply
|
| 340 |
[type.traits]: #type.traits
|
| 341 |
[type.traits.general]: #type.traits.general
|