NTTP ratio support added (resolves #49)

This commit is contained in:
Mateusz Pusz committed 2020-06-27 19:15:46 +02:00
1 parent 03facbefd2
commit d171f5451e
47 files changed
+504 -664

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ namespace units::physical::fps {
struct poundal : named_unit<poundal, "pdl", no_prefix> {};
// https://en.wikipedia.org/wiki/Pound_(force)
struct pound_force : named_scaled_unit<pound_force, "lbf", si::prefix, ratio<32'174'049, 1'000'000>, poundal> {};
struct pound_force : named_scaled_unit<pound_force, "lbf", si::prefix, ratio(32'174'049, 1'000'000), poundal> {};
struct kilopound_force : prefixed_unit<kilopound_force, si::kilo, pound_force> {};
+7 -7
View File
@@ -29,24 +29,24 @@
namespace units::physical::fps {
// https://en.wikipedia.org/wiki/Foot_(unit)
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio<3'048, 1'000, -1>, si::metre> {};
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(3'048, 1'000, -1), si::metre> {};
struct inch : named_scaled_unit<inch, "in", no_prefix, ratio<1, 12>, foot> {};
struct inch : named_scaled_unit<inch, "in", no_prefix, ratio(1, 12), foot> {};
// thousandth of an inch
struct thousandth : named_scaled_unit<thousandth, "thou", no_prefix, ratio<1, 1'000>, inch> {};
struct thousandth : named_scaled_unit<thousandth, "thou", no_prefix, ratio(1, 1'000), inch> {};
struct thou : alias_unit<thousandth, "thou", no_prefix>{};
struct mil : alias_unit<thousandth, "mil", no_prefix>{};
struct yard : named_scaled_unit<yard, "yd", si::prefix, ratio<3, 1>, foot> {};
struct yard : named_scaled_unit<yard, "yd", si::prefix, ratio(3, 1), foot> {};
struct fathom : named_scaled_unit<fathom, "ftm", no_prefix, ratio<6, 1>, foot> {};
struct fathom : named_scaled_unit<fathom, "ftm", no_prefix, ratio(6, 1), foot> {};
struct kiloyard : prefixed_unit<kiloyard, si::kilo, yard> {};
struct mile : named_scaled_unit<mile, "mile", no_prefix, ratio<5'280>, foot> {};
struct mile : named_scaled_unit<mile, "mile", no_prefix, ratio(5'280), foot> {};
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, ratio<2'000>, yard> {};
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, ratio(2'000), yard> {};
+9 -9
View File
@@ -29,28 +29,28 @@
namespace units::physical::fps {
// https://en.wikipedia.org/wiki/Pound_(mass)
struct pound : named_scaled_unit<pound, "lb", no_prefix, ratio<45'359'237, 100'000'000>, si::kilogram> {};
struct pound : named_scaled_unit<pound, "lb", no_prefix, ratio(45'359'237, 100'000'000), si::kilogram> {};
struct dim_mass : physical::dim_mass<pound> {};
template<Unit U, Scalar Rep = double>
using mass = quantity<dim_mass, U, Rep>;
struct grain : named_scaled_unit<grain, "gr", no_prefix, ratio<1, 7000>, pound>{};
struct grain : named_scaled_unit<grain, "gr", no_prefix, ratio(1, 7000), pound>{};
struct dram : named_scaled_unit<dram, "dr", no_prefix, ratio<1, 256>, pound>{};
struct dram : named_scaled_unit<dram, "dr", no_prefix, ratio(1, 256), pound>{};
struct ounce : named_scaled_unit<ounce, "oz", no_prefix, ratio<1, 16>, pound>{};
struct ounce : named_scaled_unit<ounce, "oz", no_prefix, ratio(1, 16), pound>{};
struct stone : named_scaled_unit<stone, "st", no_prefix, ratio<14, 1>, pound>{};
struct stone : named_scaled_unit<stone, "st", no_prefix, ratio(14, 1), pound>{};
struct quarter : named_scaled_unit<quarter, "qr", no_prefix, ratio<28, 1>, pound>{};
struct quarter : named_scaled_unit<quarter, "qr", no_prefix, ratio(28, 1), pound>{};
struct hundredweight : named_scaled_unit<hundredweight, "cwt", no_prefix, ratio<112, 1>, pound>{};
struct hundredweight : named_scaled_unit<hundredweight, "cwt", no_prefix, ratio(112, 1), pound>{};
struct short_ton : named_scaled_unit<short_ton, "ton (short)", no_prefix, ratio<2'000, 1>, pound>{};
struct short_ton : named_scaled_unit<short_ton, "ton (short)", no_prefix, ratio(2'000, 1), pound>{};
struct long_ton : named_scaled_unit<long_ton, "ton (long)", no_prefix, ratio<2'240, 1>, pound>{};
struct long_ton : named_scaled_unit<long_ton, "ton (long)", no_prefix, ratio(2'240, 1), pound>{};
inline namespace literals {
+1 -1
View File
@@ -35,7 +35,7 @@ struct dim_power : physical::dim_power<dim_power, foot_poundal_per_second, dim_e
struct foot_pound_force_per_second : deduced_unit<foot_pound_force_per_second, dim_power, foot_pound_force, second> {};
struct horse_power : named_scaled_unit<horse_power, "hp", no_prefix, ratio<550>, foot_pound_force_per_second> {};
struct horse_power : named_scaled_unit<horse_power, "hp", no_prefix, ratio(550), foot_pound_force_per_second> {};
template<Unit U, Scalar Rep = double>
using power = quantity<dim_power, U, Rep>;
+2 -2
View File
@@ -37,9 +37,9 @@ struct dim_pressure : physical::dim_pressure<dim_pressure, poundal_per_foot_sq,
template<Unit U, Scalar Rep = double>
using pressure = quantity<dim_pressure, U, Rep>;
struct pound_force_per_foot_sq : named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", si::prefix, ratio<32'174'049, 1'000'000>, poundal_per_foot_sq> {};
struct pound_force_per_foot_sq : named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", si::prefix, ratio(32'174'049, 1'000'000), poundal_per_foot_sq> {};
struct pound_force_per_inch_sq : named_scaled_unit<pound_force_per_inch_sq, "psi", si::prefix, ratio<1, 144>, pound_force_per_foot_sq> {};
struct pound_force_per_inch_sq : named_scaled_unit<pound_force_per_inch_sq, "psi", si::prefix, ratio(1, 144), pound_force_per_foot_sq> {};
struct kilopound_force_per_inch_sq : prefixed_unit<kilopound_force_per_inch_sq, si::kilo, pound_force_per_inch_sq> {};
+3 -3
View File
@@ -28,13 +28,13 @@
namespace units::physical::iau {
// https://en.wikipedia.org/wiki/Light-year
struct light_year : named_scaled_unit<light_year, "ly", no_prefix, ratio<9460730472580800>, si::metre> {};
struct light_year : named_scaled_unit<light_year, "ly", no_prefix, ratio(9460730472580800), si::metre> {};
// https://en.wikipedia.org/wiki/Parsec
struct parsec : named_scaled_unit<parsec, "pc", si::prefix, ratio<30'856'775'814'913'673>, si::metre> {};
struct parsec : named_scaled_unit<parsec, "pc", si::prefix, ratio(30'856'775'814'913'673), si::metre> {};
// https://en.wikipedia.org/wiki/Angstrom
struct angstrom : named_scaled_unit<angstrom, "angstrom", no_prefix, ratio<1, 1, -10>, si::metre> {};
struct angstrom : named_scaled_unit<angstrom, "angstrom", no_prefix, ratio(1, 1, -10), si::metre> {};
inline namespace literals {
+2 -2
View File
@@ -27,10 +27,10 @@
namespace units::physical::imperial {
// https://en.wikipedia.org/wiki/Chain_(unit)
struct chain : named_scaled_unit<chain, "ch", no_prefix, ratio<22, 1>, international::yard> {};
struct chain : named_scaled_unit<chain, "ch", no_prefix, ratio(22, 1), international::yard> {};
// https://en.wikipedia.org/wiki/Rod_(unit)
struct rod : named_scaled_unit<rod, "rd", no_prefix, ratio<1, 4>, chain> {};
struct rod : named_scaled_unit<rod, "rd", no_prefix, ratio(1, 4), chain> {};
inline namespace literals {
@@ -29,30 +29,30 @@ namespace units::physical::international {
// international yard
// https://en.wikipedia.org/wiki/International_yard_and_pound
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio<9'144, 1'000, -1>, si::metre> {};
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(9'144, 1'000, -1), si::metre> {};
// international foot
// https://en.wikipedia.org/wiki/Foot_(unit)#International_foot
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio<1, 3>, yard> {};
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(1, 3), yard> {};
// https://en.wikipedia.org/wiki/Fathom#International_fathom
struct fathom : named_scaled_unit<fathom, "fathom", no_prefix, ratio<2>, yard> {};
struct fathom : named_scaled_unit<fathom, "fathom", no_prefix, ratio(2), yard> {};
// international inch
// https://en.wikipedia.org/wiki/Inch#Equivalences
struct inch : named_scaled_unit<inch, "in", no_prefix, ratio<1, 36>, yard> {};
struct inch : named_scaled_unit<inch, "in", no_prefix, ratio(1, 36), yard> {};
// intrnational mile
// https://en.wikipedia.org/wiki/Mile#International_mile
struct mile : named_scaled_unit<mile, "mi", no_prefix, ratio<25'146, 15'625>, si::kilometre> {};
struct mile : named_scaled_unit<mile, "mi", no_prefix, ratio(25'146, 15'625), si::kilometre> {};
// international nautical mile
// https://en.wikipedia.org/wiki/Nautical_mile
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, ratio<1852>, si::metre> {};
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, ratio(1852), si::metre> {};
// thou
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
struct thou : named_scaled_unit<thou, "thou", no_prefix, ratio<1, 1000>, inch> {};
struct thou : named_scaled_unit<thou, "thou", no_prefix, ratio(1, 1000), inch> {};
// mil - different name for thou
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
@@ -52,7 +52,7 @@ 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", prefix, ratio<1, 60, -6>, katal> {};
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", prefix, ratio(1, 60, -6), katal> {};
struct dim_catalytic_activity : physical::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_substance> {};
+1 -1
View File
@@ -47,7 +47,7 @@ struct exajoule : prefixed_unit<exajoule, exa, joule> {};
struct zettajoule : prefixed_unit<zettajoule, zetta, joule> {};
struct yottajoule : prefixed_unit<yottajoule, yotta, joule> {};
struct electronvolt : named_scaled_unit<electronvolt, "eV", prefix, ratio<1'602'176'634, 1'000'000'000, -19>, joule> {};
struct electronvolt : named_scaled_unit<electronvolt, "eV", prefix, ratio(1'602'176'634, 1'000'000'000, -19), joule> {};
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {};
struct dim_energy : physical::dim_energy<dim_energy, joule, dim_force, dim_length> {};
+1 -1
View File
@@ -50,7 +50,7 @@ struct exametre : prefixed_unit<exametre, exa, metre> {};
struct zettametre : prefixed_unit<zettametre, zetta, metre> {};
struct yottametre : prefixed_unit<yottametre, yotta, metre> {};
struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", no_prefix, ratio<149'597'870'700>, metre> {};
struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", no_prefix, ratio(149'597'870'700), metre> {};
struct dim_length : physical::dim_length<metre> {};
@@ -50,7 +50,7 @@ struct exatesla : prefixed_unit<exatesla, exa, tesla> {};
struct zettatesla : prefixed_unit<zettatesla, zetta, tesla> {};
struct yottatesla : prefixed_unit<yottatesla, yotta, tesla> {};
struct gauss : named_scaled_unit<gauss, "G", prefix, ratio<1, 10'000>, tesla> {};
struct gauss : named_scaled_unit<gauss, "G", prefix, ratio(1, 10'000), tesla> {};
struct dim_magnetic_induction : physical::dim_magnetic_induction<dim_magnetic_induction, tesla, dim_voltage, dim_time, dim_length> {};
+1 -1
View File
@@ -72,7 +72,7 @@ struct exatonne : prefixed_alias_unit<yottagram, exa, tonne> {};
struct zettatonne : prefixed_unit<zettatonne, zetta, tonne> {};
struct yottatonne : prefixed_unit<yottatonne, yotta, tonne> {};
struct dalton : named_scaled_unit<dalton, "Da", no_prefix, ratio<16'605'390'666'050, 10'000'000'000'000, -27>, kilogram> {};
struct dalton : named_scaled_unit<dalton, "Da", no_prefix, ratio(16'605'390'666'050, 10'000'000'000'000, -27), kilogram> {};
struct dim_mass : physical::dim_mass<kilogram> {};
+20 -20
View File
@@ -29,26 +29,26 @@ namespace units::physical::si {
struct prefix : prefix_family {};
// clang-format off
struct yocto : units::prefix<yocto, prefix, "y", ratio<1, 1, -24>> {};
struct zepto : units::prefix<zepto, prefix, "z", ratio<1, 1, -21>> {};
struct atto : units::prefix<atto, prefix, "a", ratio<1, 1, -18>> {};
struct femto : units::prefix<femto, prefix, "f", ratio<1, 1, -15>> {};
struct pico : units::prefix<pico, prefix, "p", ratio<1, 1, -12>> {};
struct nano : units::prefix<nano, prefix, "n", ratio<1, 1, -9>> {};
struct micro : units::prefix<micro, prefix, {"\u00b5", "u"}, ratio<1, 1, -6>> {};
struct milli : units::prefix<milli, prefix, "m", ratio<1, 1, -3>> {};
struct centi : units::prefix<centi, prefix, "c", ratio<1, 1, -2>> {};
struct deci : units::prefix<deci, prefix, "d", ratio<1, 1, -1>> {};
struct deca : units::prefix<deca, prefix, "da", ratio<1, 1, 1>> {};
struct hecto : units::prefix<hecto, prefix, "h", ratio<1, 1, 2>> {};
struct kilo : units::prefix<kilo, prefix, "k", ratio<1, 1, 3>> {};
struct mega : units::prefix<mega, prefix, "M", ratio<1, 1, 6>> {};
struct giga : units::prefix<giga, prefix, "G", ratio<1, 1, 9>> {};
struct tera : units::prefix<tera, prefix, "T", ratio<1, 1, 12>> {};
struct peta : units::prefix<peta, prefix, "P", ratio<1, 1, 15>> {};
struct exa : units::prefix<exa, prefix, "E", ratio<1, 1, 18>> {};
struct zetta : units::prefix<zetta, prefix, "Z", ratio<1, 1, 21>> {};
struct yotta : units::prefix<yotta, prefix, "Y", ratio<1, 1, 24>> {};
struct yocto : units::prefix<yocto, prefix, "y", ratio(1, 1, -24)> {};
struct zepto : units::prefix<zepto, prefix, "z", ratio(1, 1, -21)> {};
struct atto : units::prefix<atto, prefix, "a", ratio(1, 1, -18)> {};
struct femto : units::prefix<femto, prefix, "f", ratio(1, 1, -15)> {};
struct pico : units::prefix<pico, prefix, "p", ratio(1, 1, -12)> {};
struct nano : units::prefix<nano, prefix, "n", ratio(1, 1, -9)> {};
struct micro : units::prefix<micro, prefix, {"\u00b5", "u"}, ratio(1, 1, -6)> {};
struct milli : units::prefix<milli, prefix, "m", ratio(1, 1, -3)> {};
struct centi : units::prefix<centi, prefix, "c", ratio(1, 1, -2)> {};
struct deci : units::prefix<deci, prefix, "d", ratio(1, 1, -1)> {};
struct deca : units::prefix<deca, prefix, "da", ratio(1, 1, 1)> {};
struct hecto : units::prefix<hecto, prefix, "h", ratio(1, 1, 2)> {};
struct kilo : units::prefix<kilo, prefix, "k", ratio(1, 1, 3)> {};
struct mega : units::prefix<mega, prefix, "M", ratio(1, 1, 6)> {};
struct giga : units::prefix<giga, prefix, "G", ratio(1, 1, 9)> {};
struct tera : units::prefix<tera, prefix, "T", ratio(1, 1, 12)> {};
struct peta : units::prefix<peta, prefix, "P", ratio(1, 1, 15)> {};
struct exa : units::prefix<exa, prefix, "E", ratio(1, 1, 18)> {};
struct zetta : units::prefix<zetta, prefix, "Z", ratio(1, 1, 21)> {};
struct yotta : units::prefix<yotta, prefix, "Y", ratio(1, 1, 24)> {};
// clang-format on
} // namespace units::physical::si
+3 -3
View File
@@ -37,9 +37,9 @@ struct picosecond : prefixed_unit<picosecond, pico, second> {};
struct nanosecond : prefixed_unit<nanosecond, nano, second> {};
struct microsecond : prefixed_unit<microsecond, micro, second> {};
struct millisecond : prefixed_unit<millisecond, milli, second> {};
struct minute : named_scaled_unit<minute, "min", no_prefix, ratio<60>, second> {};
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio<60>, minute> {};
struct day : named_scaled_unit<hour, "d", no_prefix, ratio<24>, hour> {};
struct minute : named_scaled_unit<minute, "min", no_prefix, ratio(60), second> {};
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio(60), minute> {};
struct day : named_scaled_unit<hour, "d", no_prefix, ratio(24), hour> {};
struct dim_time : physical::dim_time<second> {};
@@ -28,10 +28,10 @@
namespace units::physical::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)", no_prefix, ratio<4233333, 1000000, -3>, si::metre> {};
struct pica_prn : named_scaled_unit<pica_prn, "pica(prn)", no_prefix, ratio<2108759, 500000, -3>, si::metre> {};
struct point_comp : named_scaled_unit<point_comp, "point(comp)", no_prefix, ratio<1763889, 500000, -4>, si::metre> {};
struct point_prn : named_scaled_unit<point_prn, "point(prn)", no_prefix, ratio<1757299, 500000, -4>, si::metre> {};
struct pica_comp : named_scaled_unit<pica_comp, "pica(comp)", no_prefix, ratio(4233333, 1000000, -3), si::metre> {};
struct pica_prn : named_scaled_unit<pica_prn, "pica(prn)", no_prefix, ratio(2108759, 500000, -3), si::metre> {};
struct point_comp : named_scaled_unit<point_comp, "point(comp)", no_prefix, ratio(1763889, 500000, -4), si::metre> {};
struct point_prn : named_scaled_unit<point_prn, "point(prn)", no_prefix, ratio(1757299, 500000, -4), si::metre> {};
inline namespace literals {
+3 -3
View File
@@ -28,14 +28,14 @@ namespace units::physical::us {
// https://en.wikipedia.org/wiki/Foot_(unit)#US_survey_foot
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
struct foot : named_scaled_unit<foot, "ft(us)", no_prefix, ratio<1'200, 3'937>, si::metre> {};
struct foot : named_scaled_unit<foot, "ft(us)", no_prefix, ratio(1'200, 3'937), si::metre> {};
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
struct fathom : named_scaled_unit<fathom, "fathom(us)", no_prefix, ratio<6>, foot> {};
struct fathom : named_scaled_unit<fathom, "fathom(us)", no_prefix, ratio(6), foot> {};
// https://en.wikipedia.org/wiki/Mile#U.S._survey_mile
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
struct mile : named_scaled_unit<mile, "mi(us)", no_prefix, ratio<5280>, us::foot> {};
struct mile : named_scaled_unit<mile, "mi(us)", no_prefix, ratio(5280), us::foot> {};
inline namespace literals {