Skip to content
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

Adding vs multiplying quantities in different units #1941

Open
jonatanschroeder opened this issue Feb 27, 2024 · 0 comments
Open

Adding vs multiplying quantities in different units #1941

jonatanschroeder opened this issue Feb 27, 2024 · 0 comments

Comments

@jonatanschroeder
Copy link

When using Quantity(string) to parse a user-provided string corresponding to a quantity, I'm having a few issues when multiple quantities are set for the same dimensionality but different units. In particular, if a phrase contains multiple quantities for the same dimensionality, they are multiplied instead of added, even though the natural form of that phrase is typically interpreted as an addition.

For example, 20.5 minutes works, 20 minutes + 30 seconds works (and is equivalent), but 20 minutes 30 seconds is parsed as 600 minutes * seconds. Similarly, 6 ft 9 in is converted to 54 ft * in instead of 6.75 ft. Same for 6 ft, 9 in.

Is this by design? Is there a way to cause the parsing to prioritize addition instead of where appropriate, or based on a specific dimensionality (e.g., if dimensionality is length use the interpretation that leads to length)?

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

No branches or pull requests

1 participant