UnitsNet icon indicating copy to clipboard operation
UnitsNet copied to clipboard

Calculations with db are wrong

Open BernhardJosef opened this issue 5 months ago • 4 comments

Describe the bug The result of adding 2 levels is wrong The result of subtracting 2 levels is wrong

To Reproduce Level level1 = new Level(1.6, Level.ParseUnit("dB")); Level level2 = new Level(0.7, Level.ParseUnit("dB"));

Level level3 = level1 - level2; Level level4 = level1 + level2;

Expected behavior db additions or subtractions should be executed without any transformations

Additional context see https://sengpielaudio.com/calculator-db.htm

BernhardJosef avatar Jul 16 '25 14:07 BernhardJosef

Hi, thanks for reporting.

If you are able to, could you please create a pull request with a unit test that highlights the two errors and what the results should be? Huge bonus points if you also provide a fix for the implementation.

It will help move this along much faster, I have limited time to look into it.

angularsen avatar Jul 26 '25 00:07 angularsen

Relevant changes coming in https://github.com/angularsen/UnitsNet/pull/1587 Let's re-evaluate after those are merged.

angularsen avatar Jul 27 '25 17:07 angularsen

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 27 '25 02:08 github-actions[bot]

This issue was automatically closed due to inactivity.

github-actions[bot] avatar Sep 04 '25 02:09 github-actions[bot]