Skip to content

fix: round floats with floor/ceil instead of truncation - #51

Merged
DvBree merged 1 commit into
PDOK-18835/vervanging-trex-v2-vertegelingfrom
PDOK-18835/vervanging-trex-v2-rounding-coords
Sep 25, 2026
Merged

DvBree merged 1 commit into
PDOK-18835/vervanging-trex-v2-vertegelingfrom
PDOK-18835/vervanging-trex-v2-rounding-coords

Conversation

@DvBree

@DvBree DvBree commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Description

Replaces float->int conversion by truncation to floor/ceil operations. Truncation is incorrect for negative values: both 0.5 and -0.5 truncate to 0, which is undesirable.

For backwards compatibility with t_rex, we use floor for x-coordinates and ceil for y-coordinates. This was tested by comparing tiles to tiles generated by t_rex.

Type of change

  • Bugfix

Checklist:

  • I've double-checked the code in this PR myself
  • I've left the code better than before (boy scout rule)
  • The code is readable, comments are added that explain hard or non-obvious parts.
  • I've expanded/improved the (unit) tests, when applicable
  • I've run (unit) tests that prove my solution works
  • There's no sensitive information like credentials in my PR

@DvBree
DvBree merged commit e378519 into PDOK-18835/vervanging-trex-v2-vertegeling Sep 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants