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.)
Summary
RFC 0006's signature table for
roundstates it returnsintwhenndigits <= 0, and givesround(1234.5, -1)→1230as its example. The implementation returns1230.0 :: float.Versions
openjd-model0.11.1 and 0.11.2 from PyPI (both bundleopenjd-expr0.2.1)openjd-rsmainat1a89f3a— still reproducesReproduction
Expected vs actual
round(1234.5, -1)1230 :: int1230.0 :: floatWhy this is a bug
The spec's own signature table declares the
intreturn forndigits <= 0and works thisexact input. (Python's built-in
roundreturns afloathere, so this looks like Pythonbehavior standing in where the spec deliberately diverges from Python.)