New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Added support for generating logarithmic units #45
Feature: Added support for generating logarithmic units #45
Conversation
- "Logarithmic" and "LogarithmicScalingFactor" are used in the json file to indicate the unit is logarithmic. - Added a separate PowerShell script to generate the logarithmic arithmetic operator source code.
Awesome work. I actually looked at decibel and non-linear units myself, but didn't take it anywhere. If you can look at my comments then I'd be happy to merge this in. As for the domain specific units, I'm not sure whether they should be part of the main library or not. I can easily see a domain specific nuget with dependency on UnitsNet, such as UnitsNet.Audio. What do you think and if you agree, what naming would be natural? Setting up a new nuget would involve creating a new set of projects for Audio, setting the output path to a Audio subfolder of the current output path and modifying the build scripts to build, pack and publish both nugets. On the other hand, it's still a small library and maybe we can postpone splitting up into multiple nugets until there is a demand for it and possibly many more domain specific units, and bump the major version to indicate breaking changes. At this point I'm happy with either way. |
- Added documentation to logarithmic source code generator functions. - Tweaked various comments and names. - Inverted logic when checking if a unit is logarithmic so it's easier to read/understand.
I'm going to open another discussion topic for this since I have a few ideas and I don't want to clutter up this thread. |
Don't merge this, I found a bug in the addition/subtraction unit test code. EDIT: Fixed. |
…tests - The previous calculation is incorrect in certain situations. There's no way to define the expected value without re-implementing the addition/subtraction algorithm. - Developers are now responsible for creating custom logarithmic addition and subtraction unit tests.
You'll have to regenerate the files after that last commit. Other than that, is this ready to merge? |
There shouldn't be anything to regenerate since none of the existing units are logarithmic and the new scripts don't modify existing non-logarithmic units.
Yes |
Feature: Added support for generating logarithmic units
My bad, I forgot this was just preparation for adding the actual logarithmic units later. Great work! |
Level
(with units of decibels),ElectricPotentialRatio
, andPowerRatio
. I'm not sure if you want these units in your library however, since they're specialty units related to RF, electronics, and audio engineering (this is the area I work in which is why I'd like to add them).Example: