[PR #7673] Round entity move deltas like Math.round #7753

Open
opened 2026-11-03 07:23:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7673
Author: @Joansitoh
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/7631-vecdelta-round


📝 Commits (1)

  • 84de7a3 Round entity deltas like Math.round (ties toward +infinity)

📊 Changes

3 files changed (+42 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/lan/entity.rs (+7 -1)
📝 crates/horizon-core/src/jmath.rs (+25 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+10 -1)

📄 Description

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

What

Entity movement deltas quantized the base position with f64::round (ties away from zero). Vanilla VecDeltaCodec.encode uses Math.round(x * 4096.0) (ties toward +infinity), so e.g. base -2.5/4096 gave -3 in Horizon and -2 in vanilla. Added horizon_core::jmath::round with Java semantics (saturating, NaN -> 0) and used it in VecDelta::apply (horizon-protocol) and lan/entity.rs encode (also used by the full-precision check).

Tests

  • jmath::tests::round_ties_toward_positive_infinity (-2.5, 2.5, -0.5, -1.5, 0.49999999999999994, NaN, infinities).
  • vec_delta_quantizes_the_base_like_math_round, encode_rounds_ties_toward_positive_infinity.
  • tools/parity.py server_entities: PASS.

pr_ready --quick: fmt, clippy, tests (1769 passed), Python tests (614), public tree all ✅; scope 3 files, +42 −2.
Remaining affected harnesses: run by CI's parity job.

Suggested label: none

Fixes #7631

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7673 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7631-vecdelta-round` --- ### 📝 Commits (1) - [`84de7a3`](https://github.com/horizon-rust/horizon/commit/84de7a384a84a39b3f6df2bc9d95f67d8faa547c) Round entity deltas like Math.round (ties toward +infinity) ### 📊 Changes **3 files changed** (+42 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/entity.rs` (+7 -1) 📝 `crates/horizon-core/src/jmath.rs` (+25 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+10 -1) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. ## What Entity movement deltas quantized the base position with `f64::round` (ties away from zero). Vanilla `VecDeltaCodec.encode` uses `Math.round(x * 4096.0)` (ties toward +infinity), so e.g. base -2.5/4096 gave -3 in Horizon and -2 in vanilla. Added `horizon_core::jmath::round` with Java semantics (saturating, NaN -> 0) and used it in `VecDelta::apply` (horizon-protocol) and `lan/entity.rs` `encode` (also used by the full-precision check). ## Tests - `jmath::tests::round_ties_toward_positive_infinity` (-2.5, 2.5, -0.5, -1.5, 0.49999999999999994, NaN, infinities). - `vec_delta_quantizes_the_base_like_math_round`, `encode_rounds_ties_toward_positive_infinity`. - `tools/parity.py server_entities`: PASS. pr_ready --quick: fmt, clippy, tests (1769 passed), Python tests (614), public tree all ✅; scope 3 files, +42 −2. Remaining affected harnesses: run by CI's parity job. Suggested label: none Fixes #7631 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7753
No description provided.