Open Kezii opened 2 years ago
In general, dB{anyunit} (and plain unitless dB) would be nice but potentially challenging to handle. One would need to handle addition (dB{someunit} + dB{someotherunit} yields dB{someunit*someotherunit}) and probably forbid multiplication. Unit conversions from/to log units should be straightforward, but I suspect they might look confusing with standard operator precedence.
It might also be nice to actually handle B and {otherSIprefix}B, but OTOH I've nearly never saw those used.
Yeah, it will require being handled specially in the syntax and come with a special data type. It will be similar to how temperatures (acting as postfix operators) and datetimes (acting as a special data type) are handled.
The nice thing is that once this special handling is added, it will be possible to reuse it for other non-linear scales, like pH and the Richter scale.
Do you have in mind making another variant of Value or extending Number?
unit of power https://en.wikipedia.org/wiki/DBm