Skip to content

Bug(expr): round(x, ndigits) returns float for ndigits <= 0, contradicting RFC 0006's own signature table #307

Description

@uberware

Summary

RFC 0006's signature table for round states it returns int when ndigits <= 0, and gives
round(1234.5, -1)1230 as its example. The implementation returns 1230.0 :: float.

Versions

  • openjd-model 0.11.1 and 0.11.2 from PyPI (both bundle openjd-expr 0.2.1)
  • openjd-rs main at 1a89f3a — still reproduces

Reproduction

from openjd.expr import parse_expression
r = parse_expression("round(1234.5, -1)").evaluate_with_metrics()
print(str(r.value), str(r.value.type))   # -> 1230.0 float

Expected vs actual

Expression Expected (RFC 0006) Actual
round(1234.5, -1) 1230 :: int 1230.0 :: float

Why this is a bug

The spec's own signature table declares the int return for ndigits <= 0 and works this
exact input. (Python's built-in round returns a float here, so this looks like Python
behavior standing in where the spec deliberately diverges from Python.)

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