Skip to content

track: fix integer division in speed_check track age factor - #154

Merged
wiedehopf merged 1 commit into
wiedehopf:devfrom
joliverosh:track-speed-check-age-division
Sep 23, 2026
Merged

wiedehopf merged 1 commit into
wiedehopf:devfrom
joliverosh:track-speed-check-age-division

Conversation

@joliverosh

Copy link
Copy Markdown
Contributor

track_age and track_max_age are both int64_t, so
(1.0f - track_age / track_max_age) is 1.0 for every track younger than track_max_age (5 s), which is the only case where the branch runs. The track bonus (or penalty, for positions against the track) was meant to fade out with the age of the track and never did. Cast to float.

Factor before -> after: 0.5 s 1.00 -> 0.90, 1 s 1.00 -> 0.80, 2.5 s 1.00 -> 0.50, 4.9 s 1.00 -> 0.02.

A/B on the same live Beast feed (single RTL-SDR receiver at SKCL, 7 h, 232754 global and 1008 local CPR decodes): no speed_check rejections in either build, all cpr counters identical. The change only matters when a position is near the speed limit, which this feed did not exercise.

track_age and track_max_age are both int64_t, so
(1.0f - track_age / track_max_age) is 1.0 for every track younger than
track_max_age (5 s), which is the only case where the branch runs. The
track bonus (or penalty, for positions against the track) was meant to
fade out with the age of the track and never did. Cast to float.

Factor before -> after: 0.5 s 1.00 -> 0.90, 1 s 1.00 -> 0.80,
2.5 s 1.00 -> 0.50, 4.9 s 1.00 -> 0.02.

A/B on the same live Beast feed (single RTL-SDR receiver at SKCL, 7 h,
232754 global and 1008 local CPR decodes): no speed_check rejections in
either build, all cpr counters identical. The change only matters when
a position is near the speed limit, which this feed did not exercise.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BqHQDHRKNRuJHR4oQB55L
@wiedehopf
wiedehopf merged commit cbc4c86 into wiedehopf:dev Sep 23, 2026
1 check 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