[GH-ISSUE #6890] Commands format numbers with Rust {:.N} instead of Java %.Nf (worldborder, spreadplayers, debug, tp) #2242

Closed
opened 2026-11-02 15:53:17 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ClickingMaster on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6890

Originally assigned to: @ClickingMaster on GitHub.

🤖 Filed by ClickingMaster's AI agent (Claude Code, Claude Sonnet 5.5), not by ClickingMaster personally.

Several commands print numbers with Rust's format!("{:.N}"), but vanilla uses String.format(Locale.ROOT, "%.Nf"). Java rounds the shortest round-trip decimal text half-up; Rust rounds the exact binary value half-even. They differ on ties and on values like 10.35.

Examples (vanilla 26.3 vs Horizon):

  • /worldborder set 10.35 feedback shows 10.4 in vanilla (%.1f), 10.3 in Horizon.
  • /worldborder set 10.5 then /worldborder get prints 11 in vanilla (%.0f, returns Mth.floor(size + 0.5)), 10 in Horizon.
  • /worldborder damage buffer 5.125 prints 5.13 vs 5.12; same for damage amount, center.
  • /spreadplayers failure text (%.2f), /debug stop (%.2f), /tp (%f).

Sources: WorldBorderCommand.java lines 132, 143, 171, 183, 209; SpreadPlayersCommand.java; TeleportCommand.formatDouble. Horizon already has java_text::format_fixed that does this correctly; the command code does not use it.

Originally created by @ClickingMaster on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6890 Originally assigned to: @ClickingMaster on GitHub. > 🤖 Filed by ClickingMaster's AI agent (Claude Code, Claude Sonnet 5.5), not by ClickingMaster personally. Several commands print numbers with Rust's `format!("{:.N}")`, but vanilla uses `String.format(Locale.ROOT, "%.Nf")`. Java rounds the shortest round-trip decimal text half-up; Rust rounds the exact binary value half-even. They differ on ties and on values like `10.35`. Examples (vanilla 26.3 vs Horizon): - `/worldborder set 10.35` feedback shows `10.4` in vanilla (`%.1f`), `10.3` in Horizon. - `/worldborder set 10.5` then `/worldborder get` prints `11` in vanilla (`%.0f`, returns `Mth.floor(size + 0.5)`), `10` in Horizon. - `/worldborder damage buffer 5.125` prints `5.13` vs `5.12`; same for `damage amount`, `center`. - `/spreadplayers` failure text (`%.2f`), `/debug stop` (`%.2f`), `/tp` (`%f`). Sources: `WorldBorderCommand.java` lines 132, 143, 171, 183, 209; `SpreadPlayersCommand.java`; `TeleportCommand.formatDouble`. Horizon already has `java_text::format_fixed` that does this correctly; the command code does not use it.
Author
Owner

@ClickingMaster commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6571995070 --> @ClickingMaster commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2242
No description provided.