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

Result of A + B shall be determinist #98

Closed
desruisseaux opened this issue Jun 17, 2018 · 1 comment
Closed

Result of A + B shall be determinist #98

desruisseaux opened this issue Jun 17, 2018 · 1 comment

Comments

@desruisseaux
Copy link
Contributor

The result of Quantity.add(Quantity) shall be numerically equivalent for all implementations. "Numerically equivalent" means that they shall have the same numerical value (ignoring rounding errors) after conversion to the same unit by Quantity.to(Unit).

Example: 1 m + 2 cm = 1.02 m or 102 cm, at implementation choice. But can not be 2 meters.

The problem become more tricky with temperature: 1°C + 2°C may be 3°C or 276.15 °C, depending on whether the 1°C and 2°C quantities are temperature measurements or temperature increments. It is not the purpose of this issue to decide which interpretation should be applied. The purpose of this issue is to state that whatever interpretation is choose, the specification should describe it with enough details for ensuring that all implementations produce numerically equivalent results.

@desruisseaux
Copy link
Contributor Author

desruisseaux commented Jun 25, 2018

Following phone call on Thursday 21th 2018, I believe there is an agreement that arithmetic operations shall obey to arithmetic laws. This implies a determinist behavior of A + B, since there is not many ways to implement Quantity arithmetic operations in an arithmetically consistent way. Closing this issue as "accepted in principle". Concrete action will be a merge request with Javadoc updates along the line of the Arithmetic operations shall obey arithmetic laws wiki page. See #95 for discussion.

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

2 participants