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
934 stars 134 forks source link

Arguments of hyperbolic functions should not be angles. #285

Open nholthaus-units-user opened 2 years ago

nholthaus-units-user commented 2 years ago

I am using the units.h file as of commit ea6d126942cb3225a341568ab57ec52513977875. The issue described below can be reproduced using gcc-11.2.0 (and probably using any other C++14 compiler).

The hyperbolic functions in units.h (such as units::math::cosh(), for example) require that their arguments be in units of angles. However, this does not appear to be correct. Unlike trigonometric functions, arguments of hyperbolic functions are dimensionless real numbers. Compare the behaviors of std::cos() and std::cosh(), for example.

From Wikipedia:

The hyperbolic functions take a real argument called a hyperbolic angle...

In geometric applications, the argument of a trigonometric function is generally the measure of an angle. For this purpose, any angular unit is convenient, and angles are most commonly measured in conventional units of degrees in which a right angle is 90° and a complete turn is 360° (particularly in elementary mathematics).