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

Additive identity requires a unit #310

Closed
haykam821 opened this issue Sep 17, 2024 · 2 comments
Closed

Additive identity requires a unit #310

haykam821 opened this issue Sep 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@haykam821
Copy link
Contributor

Despite zero being the additive identity in the following expression, a unit conversion error is thrown (in version 1.5.2):

> 1 meter + 0
Error: cannot convert from unitless to meters: units 'unitless' and 'meter' are incompatible

However, explicitly specifying the unit results in the correct output:

> 1 meter + 0 meters
1 meter

I would expect the unitless version to work given that multiplying or dividing a value by a unitless 1 works fine.

@printfn
Copy link
Owner

printfn commented Sep 18, 2024

Thanks for the report, I agree it would make sense to support this.

@printfn printfn added the enhancement New feature or request label Sep 18, 2024
@printfn
Copy link
Owner

printfn commented Sep 22, 2024

I've implemented this now; I'll do a bit more testing to make sure there's no unintended breakage but I think it should be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants