FixedPointsArduino
FixedPointsArduino copied to clipboard
Consider providing constants in a separate namespace
At the moment the named constants (such as E, Pi, Tau and Phi) are static class members of SFixed and UFixed.
From a maintenance point of view, it would be beneficial to reduce the duplication by moving this functionality into a single place, e.g. a class or namespace provided by Utils.h.
These constants could then take the form of constexpr template functions rather than static constexpr data members. The functions would essentially pass a floating point value to the appropriate constructor of each type.
The old values could be deprecated and removed in some future breaking change, but for now simply adding a separate (preferred) source of constants would be a non-breaking additional improvement.