On Tue, Jun 18, 2024 at 3:55 PM Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

About logarithmic units:

One common pitfall is distinguishing between ratios of power or energy and ratios of amplitude.

dB has an implicit convention that it is 10 times the decimal logarithm of power ratios.

And 20 times the decimal logarithm of amplitude ratios.

It would be nice, if a unit library would automatically handle that.

At least for the cases, where energy, power and amplitude units have a physical reason.

Energy is J, Power is W

Amplitude is often pairwise, because you have a conversion between two forms of energy, e.g. E field and B field, kinetic and potential energy (as pressure or as height).

In electronics and signal processing often physical units are expressed as a voltage.

E.g. a power sensor could have a linear output in voltage.

So voltage can be an amplitude or a power.

This is **exactly** why logarithmic units make me so wary, and why the first step I would like to see is a Grand Unified Set of Tests that a wide variety of practitioners can agree on. If we can get that set of tests, then we can try to figure out a collection of software interfaces that can simultaneously satisfy all of them. And when the definition of "a decibel" varies based on whether we're dealing with power or amplitude, it makes me worry that no such collection exists!

--

Std-Proposals mailing list

Std-Proposals@lists.isocpp.org

https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals