-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
[FEEDBACK] The :math
function should be better-specified
#959
Comments
The Furthermore, the Is there some specific change that you think should be applied to this specification? |
I could certainly visualize having We have outstanding issues with matching floating point values in a selector which are probably related. But these are out of scope currently. |
If you can't select on floating point values, the risk here is lower. It might still cause the wrong plural form to be chosen or for floating point artifacts to be shown in the rendered message. |
We don't currently "precisely define" how exact matching is done for floating point values. Note that plural rules still apply and can work on non-integer values. It's also permissible that implementations match the value And obviously there are potential issues with floating point representations and their interaction with any such specification. |
As far as I can tell, in registry.md, the
:math
function allows for arbitrary addition and subtraction.I think this is a problem: it can run into the floating-point math problems well known to most programmers, such as 0.1 + 0.2 != 0.3. For example, a message of the following form does not have well-defined behavior:
Are there any use cases for this function other than adding or subtracting integers?
I suggest changing the function to restrict the domain to integers and defining that the math operates as if on decimal values. So, for example,
{1.234 :math subtract=1}
should be guaranteed to return0.234
.The text was updated successfully, but these errors were encountered: