Skip to content

fix(cli): preserve significant digits for small cellAreaRads2 values (#1307) - #1320

Open
SMC17 wants to merge 3 commits into
uber:masterfrom
SMC17:fix/cli-cell-area-rads2-precision
Open

SMC17 wants to merge 3 commits into
uber:masterfrom
SMC17:fix/cli-cell-area-rads2-precision

Conversation

@SMC17

@SMC17 SMC17 commented Nov 16, 2026 •

Copy link
Copy Markdown

Fixes #1307.

Summary

h3 cellAreaRads2 previously formatted all results with %.10lf, which rounded valid high-resolution cell areas (resolutions 12-15, e.g. 8f283082800b3b0 at ~2.29e-14 sr) to 0.0000000000.

  • Print positive cellAreaRads2 values below 1e-6 with enough decimal places to keep 5 significant digits, so high-resolution cell areas no longer round to zero. Output stays in decimal notation: 8f283082800b3b0 now prints 0.000000000000022909.
  • Keep 10 decimal places for area >= 1e-6, so existing output is unchanged (including testCliCellAreaRads2).
  • Add testCliCellAreaRads2Res15 in tests/cli/cellAreaRads2.txt.
  • Add a CHANGELOG entry.

Verification

  • Built with CMake (Debug) and ran ctest --test-dir build --output-on-failure -j: 337/337 tests passed.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The cellAreaRads2 CLI now selects decimal places for positive areas below 1e-6. Other areas retain 10 decimal places. A CLI test checks the output for cell 8f283082800b3b0.

Changes

Cell area output

Layer / File(s) Summary
Small-area formatting and validation
src/apps/filters/h3.c, tests/cli/cellAreaRads2.txt, CHANGELOG.md
For positive areas below 1e-6, cellAreaRads2 sets decimal places using 4 - floor(log10(area)). Other areas retain 10 decimal places. The CLI test expects 0.000000000000022909 for cell 8f283082800b3b0. The changelog records the formatting change.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: isaacbrodsky

Merge Risk: Minimal · up to fd274

The CLI now prints small cell areas with enough decimal places to keep five significant digits instead of rounding them to zero. Output for larger values is unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the CLI now keeps significant digits for small cellAreaRads2 values, which matches the h3.c formatting change, the test, and the changelog. It also references issue #1…
Description check Passed The description states the problem (high-resolution cell areas rounding to 0.0000000000), the formatting rule (5 significant digits below 1e-6, 10 decimals otherwise), the added test and changelog ent…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the CLI now keeps significant digits for small cellAreaRads2 values, which matches the h3.c formatting change, the test, and the changelog. It also references issue #1307. The title is specific and concise.

Full details: Description check

Explanation

The description states the problem (high-resolution cell areas rounding to 0.0000000000), the formatting rule (5 significant digits below 1e-6, 10 decimals otherwise), the added test and changelog entry, and the verification steps. All of these match the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c1ccf1bb-ea1f-4061-8b85-3ba1143f0c6d
Commits

Reviewing files that changed from the base of the PR and between 5145d28 and fd27496.

Files selected for processing: 2

  • CHANGELOG.md
  • src/apps/filters/h3.c
Files skipped from review as they are similar to previous changes: 1

  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

SMC17 added a commit to SMC17/SMC17 that referenced this pull request Nov 16, 2026
Instead of switching to scientific notation below 1e-6, print more
decimal places: as many as it takes to keep 5 significant digits, which
is what a resolution 5 cell already gets from 10 places. Output for
areas of 1e-6 and above is unchanged, and precision no longer jumps at
the threshold.

The resolution 15 test now expects 5 significant digits rather than 8,
which is well within what the area calculation reproduces across
platforms.

Also adds the CHANGELOG entry.

Co-Authored-By: Claude Code <[email protected]>
@justinhwang

Copy link
Copy Markdown
Collaborator

Thanks for the fix! I pushed a commit to this branch that keeps the output in decimal notation instead of switching to scientific notation below 1e-6:

  • Areas of 1e-6 and above still print with 10 decimal places, so existing output is unchanged.
  • Below 1e-6, the number of decimal places grows to keep 5 significant digits, which is what a resolution 5 cell already gets. The resolution 15 test cell now prints 0.000000000000022909.
  • Added a CHANGELOG entry.

I also updated the PR description to match.

SMC17 added a commit to SMC17/SMC17 that referenced this pull request Nov 17, 2026
Resolve the CHANGELOG.md conflict: 4.6.0 has been released, so move the
cellAreaRads2 entry to the Unreleased section.

Co-Authored-By: Claude Code <[email protected]>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.687%. remained the same — SMC17:fix/cli-cell-area-rads2-precision into uber:master

This branch has not been deployed

No deployments
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.

5 participants