prefixes
The standardised SI prefixes, provided as type aliases of ratio. They can be
used to express a value in terms of a SI unit, for example milli represents
1e-3.
namespace opentl {
using yocto = ratio<1, 1000000000000000000000000>;
using zepto = ratio<1, 1000000000000000000000>;
using atto = ratio<1, 1000000000000000000>;
using femto = ratio<1, 1000000000000000>;
using pico = ratio<1, 1000000000000>;
using nano = ratio<1, 1000000000>;
using micro = ratio<1, 1000000>;
using milli = ratio<1, 1000>;
using centi = ratio<1, 100>;
using deci = ratio<1, 10>;
using deca = ratio<10, 1>;
using hecto = ratio<100, 1>;
using kilo = ratio<1000, 1>;
using mega = ratio<1000000, 1>;
using giga = ratio<1000000000, 1>;
using tera = ratio<1000000000000, 1>;
using peta = ratio<1000000000000000, 1>;
using exa = ratio<1000000000000000000, 1>;
using zetta = ratio<1000000000000000000000, 1>;
using yotta = ratio<1000000000000000000000000, 1>;
}
Type Aliases
| Name | Value | Description |
|---|---|---|
yocto |
1e-24 | Only when intmax_t is wide enough. |
zepto |
1e-21 | Only when intmax_t is wide enough. |
atto |
1e-18 | |
femto |
1e-15 | |
pico |
1e-12 | |
nano |
1e-9 | |
micro |
1e-6 | |
milli |
1e-3 | |
centi |
1e-2 | |
deci |
1e-1 | |
deca |
1e1 | |
hecto |
1e2 | |
kilo |
1e3 | |
mega |
1e6 | |
giga |
1e9 | |
tera |
1e12 | |
peta |
1e15 | |
exa |
1e18 | |
zetta |
1e21 | Only when intmax_t is wide enough. |
yotta |
1e24 | Only when intmax_t is wide enough. |
Example
#include <opentl/ratio.hpp>
int main() {
using kilogram = opentl::kilo;
static_assert(kilogram::num == 1000);
static_assert(kilogram::den == 1);
}