Skip to content

[BUG] math.round incorrectly uses HALF_EVEN instead of HALF_UP #1055

Description

@rayokota

Describe the bug
math.round uses HALF_EVEN (banker's rounding) internally, but cel-java's own function declaration, cel-go's reference implementation, and cel-cpp's reference implementation all specify "ties round away from zero". cel-java is the outlier among the three official reference clients; math.round should instead use HALF_UP

To Reproduce
Check which components this affects:

  • parser
  • checker
  • runtime

Sample expression and input that reproduces the issue:

// sample expression string
math.round(42.5) == 42.0 // should be 43.0

Fix is at #1054

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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