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

Mix type compatible unit values #143

Open
pmjordan opened this issue Mar 1, 2023 · 3 comments
Open

Mix type compatible unit values #143

pmjordan opened this issue Mar 1, 2023 · 3 comments

Comments

@pmjordan
Copy link
Contributor

pmjordan commented Mar 1, 2023

There is no guidance within the scalar definition or range definition regarding whether compatible units but different units can be compared or used in a range, e.g. is a time range of [1 s, 1 h] acceptable?

@lauwers
Copy link
Contributor

lauwers commented Mar 1, 2023

My interpretation is that such a range is acceptable. Implementations should also be able to verify that $equal(60 s, 1 h) is True

@pmjordan
Copy link
Contributor Author

pmjordan commented Mar 1, 2023

Then perhaps we could change the example in 5.2.2.4.2 to show a mix of type compatible unit values.

@tliron
Copy link
Contributor

tliron commented Mar 1, 2023

It is clear to me that this is the case, that the whole point of scalars is that the unit doesn't matter internally. You can see in Puccini's implementation that every type is internally converted to a "canonical number" (and unit), which is used for comparisons, e.g. the canonical unit for time is seconds. Maybe we need to specify the canonical unit explicitly in TOSCA because it will have an effect on precision during conversions, which could have implications for very large or very small values with different units.

BTW, the original unit and is still preserved in Puccini (it's in the Clout), but in the TOSCA spec it shouldn't matter because we don't enforce any data storage model.

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

3 participants