-
Notifications
You must be signed in to change notification settings - Fork 242
string.format
extension should output scientific notation consistent with CEL spec
#1100
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
Comments
It turns out there were two issues:
It appears that both issues will be addressed, but the scope of this bug will be to temporarily strip narrow spaces on exponents until Golang updates to support the same. |
Switching away from the multiplication sign and exponent would be a bigger change than just stripping the narrow spaces... it's not clear to me that the format library must output something that CEL could parse back as a number in the CEL grammar. |
golang/text@221d88c now strips the spaces in the latest tag |
@liggitt the PR from @jcking versions the format change considering it could break tests. In looking at the complexity introduced by locales, we opted to stick with C-format and remove locales since the outputs would likely only need to be developer-readable. At some point we may introduce locales, but we won't mix developer and non-developer formatting, e.g map / list format alongside locale numeric formatting. |
as the golang.org/x/text change did when we bumped things in kubernetes - kubernetes/kubernetes#130913 (comment) will CEL still inherit the narrow space stripping change from x/text? |
Yes, unfortunately, it will. Do you need us to undo it in a patch? |
Not necessarily, just trying to figure out how we'll react downstream in a way we won't have to undo when we pull in a CEL update. I have a hard time imagining someone taking a dependency on the exact output of the current %e formatter except in a test |
google/cel-go#1100 Signed-off-by: Benjamin Wang <[email protected]>
google/cel-go#1100 Signed-off-by: Benjamin Wang <[email protected]>
google/cel-go#1100 Signed-off-by: Benjamin Wang <[email protected]> Kubernetes-commit: 24536987d89b4537e9254ec815255225504a211b
google/cel-go#1100 Signed-off-by: Benjamin Wang <[email protected]>
Describe the bug
The
string.format
extension currently outputs scientific notation rendered using a unicode multiplication sign×
and superscript for the exponent2.718280 × 10⁰⁰
.To Reproduce
Check which components this affects:
string.format
extensionSample expression and input that reproduces the issue:
Test setup:
Existing test case.
Expected behavior
The output should instead be conforming to the CEL spec:
2.718280E+00
or2.718280e+00
The text was updated successfully, but these errors were encountered: