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

Should we rename quantity::number() to value()? #423

Closed
mpusz opened this issue Jan 10, 2023 · 8 comments
Closed

Should we rename quantity::number() to value()? #423

mpusz opened this issue Jan 10, 2023 · 8 comments
Labels
design Design-related discussion question Further information is requested

Comments

@mpusz
Copy link
Owner

mpusz commented Jan 10, 2023

ISO/IEC Guide 99:2007 says:

quantity
property of a phenomenon, body, or substance, where the property has a magnitude that can be expressed as a number and a reference

On the other hand, it also specifies a term numerical quantity value

numerical quantity value
numerical value of a quantity
numerical value
number in the expression of a quantity value, other than any number serving as the reference

ISO 80000-1:2022 in chapter 6.2 says:

...any other quantity of the same kind can be expressed in terms of this unit, as a product of this unit and a number. That number is called the numerical value of the quantity expressed in this unit.
It is essential to distinguish between the quantity itself and the numerical value of the quantity expressed in a particular unit.

@JohelEGP
Copy link
Collaborator

I bet SG15 has good input on this. Anyways, going by the name alone, what value returns is less clear than number. I'd just document that number returns the numerical quantity value.

@m5k8
Copy link

m5k8 commented Jan 21, 2023

+1 for value().

@BenFrantzDale
Copy link

I'm cool with value. Per #434 and #412 I think it needs to be fully explicit when you pack and unpack values in order to be robust against refactorings (and to just be fully clear: f(foo.value()) doesn't mean anything; f(foo.value_in<millimeters>()) does.

@mpusz
Copy link
Owner Author

mpusz commented Feb 2, 2023

Sure, if we decide to rename it, we will change the name of both functions.

@mpusz mpusz added design Design-related discussion question Further information is requested labels Jun 24, 2023
@JohelEGP
Copy link
Collaborator

JohelEGP commented Aug 1, 2023

The data for containers only returns part of the value,
as you need size to be able to traverse the data.
Except for std::string, which is null-terminated.
That's why I'm against #423.
A quantity value is already a value,
so quantity::value returning the number/numerical quantity value feels wrong.
-- Extract from #477 (comment).

@nuuSolutions
Copy link

nuuSolutions commented Aug 13, 2023

Not sure why this is even a question.
For me (as a physicist) a quantity is specified by a value, a unit and possibly some additional reference system.

number() just sounds completely off and always makes me wonder if it is an integer.
Sure, a value is represented by a (real or natural) number, but that's one level below.
In other words: mathematics/CS has numbers, physics has values!

I would also be fine with numerical_value() and numerical_value_in<mm>() although this seems a bit verbose. Then again these should not be used too much in code.

@mpusz mpusz closed this as completed in a9204e2 Aug 23, 2023
@mpusz mpusz reopened this Aug 29, 2023
@mpusz
Copy link
Owner Author

mpusz commented Aug 29, 2023

Is seems we should revise this issue. Today I was going again through the terms in ISO and SI to check for a better alternative of Reference (issue #486) and I found the following:

quantity value, value of a quantity value

number and reference together expressing magni­tude of a quantity

EXAMPLE 1:Length of a given rod:
5.34 m or 534 cm

https://jcgm.bipm.org/vim/en/1.19.html

It seems that according to both ISO and SI, the "value" contains both a number and a unit, but in this feature, we return only a number. So maybe we should revert the previous number() and number_in() member functions?

@mpusz
Copy link
Owner Author

mpusz commented Aug 29, 2023

Alternatively, as proposed by @JohelEGP above we could use numerical_value as the official documentation states:

numerical quantity value, numerical value of a quantity, numerical value

number in the expression of a quantity value, other than any number serving as the reference

https://jcgm.bipm.org/vim/en/1.20.html

@mpusz mpusz closed this as completed in f1c2c74 Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design-related discussion question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants