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

Scaling + simplification drops errors #214

Closed
Enchufa2 opened this issue Oct 24, 2019 · 2 comments
Closed

Scaling + simplification drops errors #214

Enchufa2 opened this issue Oct 24, 2019 · 2 comments

Comments

@Enchufa2
Copy link
Member

We have:

set_quantities(1.1, m, 0.1) * set_quantities(1.1, m^-1, 0.1)
## 1.2(2) [1]

Simplification to unitless, and errors are preserved. Ok. But at least when scaling is needed too, this happens:

set_quantities(1100, mm, 100) * set_quantities(1.1, m^-1, 0.1)
## 1.21 [1]
set_quantities(1100, mm, 100) / set_quantities(1.1, m, 0.1)
## 1 [1]

Errors are dropped, which means that some path in units is not calling NextMethod.

@Enchufa2 Enchufa2 changed the title Scaling + simplification drops units Scaling + simplification drops errors Oct 24, 2019
@Enchufa2
Copy link
Member Author

This behaviour seems related, because again errors are dropped:

set_quantities(1, 1/nm) * set_quantities(1, m) / set_quantities(1, mm)
## 1e+09 [1]
## Warning message:
## Incompatible methods ("Ops.units", "Ops.quantities") for "/"

@Enchufa2
Copy link
Member Author

Fixed in r-quantities/quantities#3. Not the ideal solution, but it works. There is room for improvement if we export here at some point functions to simplify units, as we were discussing in #132.

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