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

WIP: Fix Offset conversion with prefix & conversions using offset units #1509

Closed
wants to merge 3 commits into from

Conversation

jules-ch
Copy link
Collaborator

Well it works but the implementation is so ugly.

It basically using an iterator to get converter from unit to base unit & making conversion from src to base & then from base to dst.

prefixed_src -> src_referenced -> ... -> base

base -> ... -> dst_reference -> prefixed_dst

It is similar to what happens with multiplicative, but this time I'm using an iterator instead of the recursive function used in get_roots_units with the accumulator.

I had to use some trickery for to identify the prefixed unit as non multiplicative.
I think we need to work on this, since if a converter is non multiplicative in this tree going back to base unit, well conversion will be non multiplicative.

If you guys have insights, I feel like this is clearly not OK in terms of clarity.

@jules-ch jules-ch marked this pull request as draft April 12, 2022 21:03
@OrangeChannel
Copy link

See #1381 (comment) . I also don't think prefixing offset units should be allowed at all. Practically I get that a kilodegC is 1000 °C but an object at 1 kilodegC is not a thousand times hotter than something that is 1 degC right? The multiplication implies by prefixes doesn't physically make sense here.

@jules-ch jules-ch closed this Jul 5, 2022
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.

Problems when converting values with offset and prefixes
2 participants