nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
938 stars 134 forks source link

New unit: Gal #272

Open krofik opened 3 years ago

krofik commented 3 years ago

Gal is a unit for acceleration which is widely used in gravimetry / geodesy research. 1Gal == 1 cm / s^2, but also be defined as fraction of standard gravity.

UNIT_ADD(acceleration , gal, Gals, Gal, unit<std::ratio<25493LL, 25000000LL>, standard_gravity>)

It would collapse with abbreviation of Gallon unit if lower case Gal ware used instead. Here is wiki page and Germany's National Institute reference (page 30) about Gal.

JohelEGP commented 3 years ago

Why choose the fraction of standard gravity instead of 1 cm / s^2, when the latter is less likely to cause problems with precision and overflows?

krofik commented 3 years ago

You are right. Previously I had difficulties with defining compound units and therefore this solution looked plausible for me.

nholthaus commented 1 year ago

added support in 3.0. Consider backporting to 2.3