mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-07 14:14:27 +02:00
Migrate explicit-exp
inputs
This commit is contained in:
@@ -54,7 +54,7 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_scaled_unit<foot, "ft", as_magnitude<ratio(3'048, 1'000, -1)>(), metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", as_magnitude<ratio{3'048, 10'000}>(), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<3>(), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
@@ -37,7 +37,7 @@ namespace units::isq::si::hep {
|
||||
// effective cross-sectional area according to EU council directive 80/181/EEC
|
||||
// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10
|
||||
// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de
|
||||
struct barn : named_scaled_unit<barn, "b", as_magnitude<ratio(1, 1, -28)>(), square_metre> {};
|
||||
struct barn : named_scaled_unit<barn, "b", pow<-28>(as_magnitude<10>()), square_metre> {};
|
||||
struct yocto_barn : prefixed_unit<yocto_barn, yocto, barn> {};
|
||||
struct zepto_barn : prefixed_unit<zepto_barn, zepto, barn> {};
|
||||
struct atto_barn : prefixed_unit<atto_barn, atto, barn> {};
|
||||
|
@@ -44,7 +44,8 @@ namespace units::isq::si::hep {
|
||||
|
||||
struct eV_per_c2 :
|
||||
named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"},
|
||||
as_magnitude<ratio(17'826'619'216'279, 1'000'000'000'000, -35)>(), kilogram> {};
|
||||
as_magnitude<ratio(17'826'619'216'279, 1'000'000'000'000)>() * pow<-35>(as_magnitude<10>()),
|
||||
kilogram> {};
|
||||
struct feV_per_c2 : prefixed_unit<feV_per_c2, femto, eV_per_c2> {};
|
||||
struct peV_per_c2 : prefixed_unit<peV_per_c2, pico, eV_per_c2> {};
|
||||
struct neV_per_c2 : prefixed_unit<neV_per_c2, nano, eV_per_c2> {};
|
||||
@@ -60,11 +61,17 @@ struct PeV_per_c2 : prefixed_unit<PeV_per_c2, peta, eV_per_c2> {};
|
||||
struct EeV_per_c2 : prefixed_unit<EeV_per_c2, exa, eV_per_c2> {};
|
||||
struct YeV_per_c2 : prefixed_unit<YeV_per_c2, yotta, eV_per_c2> {};
|
||||
struct electron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_e", as_magnitude<ratio(9'109'383'701'528, 1'000'000'000'000, -31)>(), kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_e",
|
||||
as_magnitude<ratio(9'109'383'701'528, 1'000'000'000'000)>() * pow<-31>(as_magnitude<10>()),
|
||||
kilogram> {};
|
||||
struct proton_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_p", as_magnitude<ratio(1'672'621'923'695, 1'000'000'000'000, -27)>(), kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_p",
|
||||
as_magnitude<ratio(1'672'621'923'695, 1'000'000'000'000)>() * pow<-27>(as_magnitude<10>()),
|
||||
kilogram> {};
|
||||
struct neutron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_n", as_magnitude<ratio(1'674'927'498'049, 1'000'000'000'000, -27)>(), kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_n",
|
||||
as_magnitude<ratio(1'674'927'498'049, 1'000'000'000'000)>() * pow<-27>(as_magnitude<10>()),
|
||||
kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<eV_per_c2> {};
|
||||
|
||||
|
@@ -41,7 +41,8 @@ namespace units::isq::si::hep {
|
||||
struct kilogram_metre_per_second : derived_unit<kilogram_metre_per_second> {};
|
||||
|
||||
struct eV_per_c :
|
||||
named_scaled_unit<eV_per_c, "eV/c", as_magnitude<ratio(5'344'285'992'678, 1'000'000'000'000, -35)>(),
|
||||
named_scaled_unit<eV_per_c, "eV/c",
|
||||
as_magnitude<ratio(5'344'285'992'678, 1'000'000'000'000)>() * pow<-35>(as_magnitude<10>()),
|
||||
kilogram_metre_per_second> {};
|
||||
struct feV_per_c : prefixed_unit<feV_per_c, femto, eV_per_c> {};
|
||||
struct peV_per_c : prefixed_unit<peV_per_c, pico, eV_per_c> {};
|
||||
|
@@ -42,7 +42,7 @@ struct light_year : named_scaled_unit<light_year, "ly", as_magnitude<94607304725
|
||||
struct parsec : named_scaled_unit<parsec, "pc", as_magnitude<30'856'775'814'913'673>(), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Angstrom
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", as_magnitude<ratio(1, 1, -10)>(), si::metre> {};
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", pow<-10>(as_magnitude<10>()), si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace units::isq::si::international {
|
||||
|
||||
// si::international yard
|
||||
// https://en.wikipedia.org/wiki/International_yard_and_pound
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<ratio(9'144, 1'000, -1)>(), si::metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<ratio{9'144, 10'000}>(), si::metre> {};
|
||||
|
||||
// si::international foot
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#International_foot
|
||||
|
@@ -38,11 +38,16 @@ namespace units::isq::si::typographic {
|
||||
// TODO Conflicts with (https://en.wikipedia.org/wiki/Pica_(typography)), verify correctness of below conversion factors
|
||||
// and provide hyperlinks to definitions
|
||||
struct pica_comp :
|
||||
named_scaled_unit<pica_comp, "pica(comp)", as_magnitude<ratio(4233333, 1000000, -3)>(), si::metre> {};
|
||||
struct pica_prn : named_scaled_unit<pica_prn, "pica(prn)", as_magnitude<ratio(2108759, 500000, -3)>(), si::metre> {};
|
||||
named_scaled_unit<pica_comp, "pica(comp)", as_magnitude<4'233'333>() * pow<-9>(as_magnitude<10>()), si::metre> {};
|
||||
struct pica_prn :
|
||||
named_scaled_unit<pica_prn, "pica(prn)", as_magnitude<ratio(2108759, 500000)>() * pow<-3>(as_magnitude<10>()),
|
||||
si::metre> {};
|
||||
struct point_comp :
|
||||
named_scaled_unit<point_comp, "point(comp)", as_magnitude<ratio(1763889, 500000, -4)>(), si::metre> {};
|
||||
struct point_prn : named_scaled_unit<point_prn, "point(prn)", as_magnitude<ratio(1757299, 500000, -4)>(), si::metre> {};
|
||||
named_scaled_unit<point_comp, "point(comp)", as_magnitude<ratio(1763889, 500000)>() * pow<-4>(as_magnitude<10>()),
|
||||
si::metre> {};
|
||||
struct point_prn :
|
||||
named_scaled_unit<point_prn, "point(prn)", as_magnitude<ratio(1757299, 500000)>() * pow<-4>(as_magnitude<10>()),
|
||||
si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@@ -58,7 +58,8 @@ struct exakatal : prefixed_unit<exakatal, exa, katal> {};
|
||||
struct zettakatal : prefixed_unit<zettakatal, zetta, katal> {};
|
||||
struct yottakatal : prefixed_unit<yottakatal, yotta, katal> {};
|
||||
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", as_magnitude<ratio(1, 60, -6)>(), katal> {};
|
||||
struct enzyme_unit :
|
||||
named_scaled_unit<enzyme_unit, "U", as_magnitude<ratio(1, 60)>() * pow<-6>(as_magnitude<10>()), katal> {};
|
||||
|
||||
struct dim_catalytic_activity :
|
||||
isq::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_amount_of_substance> {};
|
||||
|
@@ -56,7 +56,8 @@ struct yottajoule : prefixed_unit<yottajoule, yotta, joule> {};
|
||||
// N.B. electron charge (and eV) is an exact constant:
|
||||
// https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf#page=147
|
||||
struct electronvolt :
|
||||
named_scaled_unit<electronvolt, "eV", as_magnitude<ratio(1'602'176'634, 1'000'000'000, -19)>(), joule> {};
|
||||
named_scaled_unit<electronvolt, "eV",
|
||||
as_magnitude<ratio(1'602'176'634, 1'000'000'000)>() * pow<-19>(as_magnitude<10>()), joule> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, joule, dim_force, dim_length> {};
|
||||
|
@@ -79,7 +79,9 @@ struct zettatonne : prefixed_unit<zettatonne, zetta, tonne> {};
|
||||
struct yottatonne : prefixed_unit<yottatonne, yotta, tonne> {};
|
||||
|
||||
struct dalton :
|
||||
named_scaled_unit<dalton, "Da", as_magnitude<ratio(16'605'390'666'050, 10'000'000'000'000, -27)>(), kilogram> {};
|
||||
named_scaled_unit<dalton, "Da",
|
||||
as_magnitude<ratio(16'605'390'666'050, 10'000'000'000'000)>() * pow<-27>(as_magnitude<10>()),
|
||||
kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<kilogram> {};
|
||||
|
||||
|
@@ -579,8 +579,7 @@ static_assert(is_same_v<decltype(1_q_km % 1_q_m), length<kilometre, std::int64_t
|
||||
|
||||
// different dimensions
|
||||
static_assert(compare<decltype(1_q_m_per_s * 1_q_s), length<metre, std::int64_t>>);
|
||||
static_assert(
|
||||
compare<decltype(1_q_m_per_s * 1_q_h), length<scaled_unit<as_magnitude<ratio(36, 1, 2)>(), metre>, std::int64_t>>);
|
||||
static_assert(compare<decltype(1_q_m_per_s * 1_q_h), length<scaled_unit<as_magnitude<3600>(), metre>, std::int64_t>>);
|
||||
static_assert(
|
||||
compare<decltype(1_q_m * 1_q_min), quantity<unknown_dimension<exponent<dim_length, 1>, exponent<dim_time, 1>>,
|
||||
scaled_unit<as_magnitude<60>(), unknown_coherent_unit>, std::int64_t>>);
|
||||
@@ -590,7 +589,7 @@ static_assert(
|
||||
static_assert(compare<decltype(1 / 1_q_Hz), isq::si::time<second, std::int64_t>>);
|
||||
static_assert(compare<decltype(1 / 1_q_km),
|
||||
quantity<unknown_dimension<exponent<dim_length, -1>>,
|
||||
scaled_unit<as_magnitude<ratio(1, 1, -3)>(), unknown_coherent_unit>, std::int64_t>>);
|
||||
scaled_unit<as_magnitude<ratio(1, 1000)>(), unknown_coherent_unit>, std::int64_t>>);
|
||||
static_assert(compare<decltype(1_q_km / 1_q_m), dimensionless<scaled_unit<as_magnitude<1000>(), one>, std::int64_t>>);
|
||||
static_assert(compare<decltype(1_q_m / 1_q_s), speed<metre_per_second, std::int64_t>>);
|
||||
static_assert(
|
||||
@@ -889,7 +888,7 @@ static_assert(is_same_v<decltype(10_q_m / 5_q_s),
|
||||
quantity<unknown_dimension<units::exponent<dim_length, 1>, units::exponent<dim_time, -1>>,
|
||||
scaled_unit<as_magnitude<1>(), unknown_coherent_unit>, std::int64_t>>);
|
||||
static_assert(
|
||||
is_same_v<decltype(1_q_mm + 1_q_km), length<scaled_unit<as_magnitude<ratio(1, 1, -3)>(), metre>, std::int64_t>>);
|
||||
is_same_v<decltype(1_q_mm + 1_q_km), length<scaled_unit<as_magnitude<ratio(1, 1000)>(), metre>, std::int64_t>>);
|
||||
|
||||
#else
|
||||
|
||||
|
@@ -36,12 +36,12 @@ using namespace units::isq;
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct centimetre : prefixed_unit<centimetre, si::centi, metre> {};
|
||||
struct kilometre : prefixed_unit<kilometre, si::kilo, metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<ratio(9'144, 1, -4)>(), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<ratio{9'144, 10'000}>(), metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", as_magnitude<ratio(1, 3)>(), yard> {};
|
||||
struct dim_length : base_dimension<"length", metre> {};
|
||||
|
||||
struct second : named_unit<second, "s"> {};
|
||||
struct hour : named_scaled_unit<hour, "h", as_magnitude<ratio(36, 1, 2)>(), second> {};
|
||||
struct hour : named_scaled_unit<hour, "h", as_magnitude<3600>(), second> {};
|
||||
struct dim_time : base_dimension<"time", second> {};
|
||||
|
||||
struct kelvin : named_unit<kelvin, "K"> {};
|
||||
@@ -60,7 +60,7 @@ struct kilometre_per_hour : derived_scaled_unit<kilometre_per_hour, dim_speed, k
|
||||
static_assert(equivalent<metre::named_unit, metre>);
|
||||
static_assert(equivalent<metre::scaled_unit, metre>);
|
||||
static_assert(compare<downcast<scaled_unit<as_magnitude<1>(), metre>>, metre>);
|
||||
static_assert(compare<downcast<scaled_unit<as_magnitude<ratio(1, 1, -2)>(), metre>>, centimetre>);
|
||||
static_assert(compare<downcast<scaled_unit<as_magnitude<ratio(1, 100)>(), metre>>, centimetre>);
|
||||
static_assert(compare<downcast<scaled_unit<yard::mag, metre>>, yard>);
|
||||
static_assert(compare<downcast<scaled_unit<yard::mag / as_magnitude<3>(), metre>>, foot>);
|
||||
static_assert(compare<downcast<scaled_unit<kilometre::mag / hour::mag, metre_per_second>>, kilometre_per_hour>);
|
||||
|
Reference in New Issue
Block a user