Skip to content

Fix math functions for percent#329

Open
StefanoD wants to merge 2 commits into
nholthaus:v3.xfrom
StefanoD:v3.x
Open

Fix math functions for percent#329
StefanoD wants to merge 2 commits into
nholthaus:v3.xfrom
StefanoD:v3.x

Conversation

@StefanoD
Copy link
Copy Markdown

@StefanoD StefanoD commented Jan 19, 2024

Fixes #328

Note: I tried to alter all math functions, but this resulted in some unit tests failing. There might be some rework needed from somebody with more knowledge.

@nholthaus
Copy link
Copy Markdown
Owner

I think this may stem from a misunderstanding of how concentrations are intended to work. The following tests will pass in the library as it currently exists:

percent resultPct = sqrt(16.0_pct);
EXPECT_EQ(resultPct, 4.0_pct);
EXPECT_EQ(0.04, resultPct);

So the idea is that 4% when it's a dimensionless absolute value is 0.04.

@chiphogg
Copy link
Copy Markdown

chiphogg commented Dec 9, 2024

Shouldn't sqrt(16.0_pct) result in something like "4 perten" (made-up unit), which when converted to percent would result in 40.0_pct, not 4.0_pct?

@StefanoD
Copy link
Copy Markdown
Author

StefanoD commented Dec 9, 2024

If you go to my linked ticket, I showed different calculations which failed. This is IMHO a regression which previously worked in an older version.
Anyway: We are using the Aurora units lib now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants