Skip to content

string.format extension should output scientific notation consistent with CEL spec #1100

Closed
@zeitgeist87

Description

@zeitgeist87

Describe the bug
The string.format extension currently outputs scientific notation rendered using a unicode multiplication sign × and superscript for the exponent 2.718280 × 10⁰⁰.

To Reproduce
Check which components this affects:

  • parser
  • checker
  • interpreter
  • string.format extension

Sample expression and input that reproduces the issue:

"%e".format([2.71828])

Test setup:
Existing test case.

Expected behavior
The output should instead be conforming to the CEL spec: 2.718280E+00 or 2.718280e+00

FLOAT_LIT      ::= -? DIGIT* . DIGIT+ EXPONENT? | -? DIGIT+ EXPONENT
DIGIT          ::= [0-9]
HEXDIGIT       ::= [0-9abcdefABCDEF]
EXPONENT       ::= [eE] [+-]? DIGIT+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions