Skip to content

fix: scale divides by first value without zero guard - #98

Open
andrewwhitecdw wants to merge 4 commits into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/table-0103ab27
Open

fix: scale divides by first value without zero guard#98
andrewwhitecdw wants to merge 4 commits into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/table-0103ab27

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Problem

fix: scale divides by first value without zero guard

Fix

Replace:

    slope, _ = np.polyfit(x, y, 1)
    return slope / values[0] + 1.0

with:

    slope, _ = np.polyfit(x, y, 1)
    if values[0] == 0:
        return 0.0
    return slope / values[0] + 1.0

Files changed

  • bobber/lib/analysis/table.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review July 28, 2026 00:37
nvidia-sweep repair bot added 3 commits July 31, 2026 20:19
Auditor: The guard returns 0.0 for a zero baseline, but this function computes a relative scale ratio (slope/first value + 1), so the undefined zero-baseline case should be NaN/raise, not a misleading finite scale. This silently changes semantics and lacks a regression test.
Auditor: Proposed diff adds a zero guard but returns float('nan'), which contradicts the stated fix (return 0.0) and could propagate NaN downstream instead of a finite sentinel.
Auditor: Returning 0.0 when values[0] == 0 is an arbitrary sentinel that masks an undefined relative scale and can silently corrupt downstream calculations; the guard is also placed after an unnecessary polyfit, and no regression test verifies the behavior.
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.

1 participant