-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix for #307 #308
fix for #307 #308
Conversation
…ke some units containing combinations of those units work better.
for more information, see https://pre-commit.ci
…o meters_second_fix
for more information, see https://pre-commit.ci
auto speedUnit = unit_from_string("mm/s"); | ||
EXPECT_EQ(to_string(speedUnit), "mm/s"); | ||
|
||
auto accUnit = unit_from_string("mm/s^2"); | ||
EXPECT_EQ(to_string(accUnit), "mm/s^2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked if these are the only examples, or is this part of a wider class of regressions that was introduced recently?
For example, km/s
currently also formats as kHz*m
, is this also fixed by the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cause of this issue is a combination of two things. The first being a check taking a single base unit away from the unit, and 'm' was first in the list. so the remaining portions of the unit were then converted in isolation and since 1/s=Hz it also adds any prefix, by swapping the order to dealing with 's' first it takes care combinations of 'm' and 's' a bit better. So as best as I can tell the only types of unit this issue is affecting is combinations of 'meter' and 'second' so yes it also fixes fixes km/s. and gray being m^2/s^2 is a bit of quirk as well, that comes from handling meters in this fashion before s^2 so adding that check first solves that issue as well.
for more information, see https://pre-commit.ci
Change the order of to_string processing for meters and seconds to ma…ke some units containing combinations of those units work better.
Fix Issue #307.