Skip to content

Keep subnormal plot ranges finite#3539

Open
Kkkakania wants to merge 1 commit into
pyqtgraph:masterfrom
Kkkakania:agent/finite-subnormal-ranges
Open

Keep subnormal plot ranges finite#3539
Kkkakania wants to merge 1 commit into
pyqtgraph:masterfrom
Kkkakania:agent/finite-subnormal-ranges

Conversation

@Kkkakania

Copy link
Copy Markdown

Summary

  • clamp only overflowed ViewBox scale factors to the signed maximum finite float
  • apply the same finite-scale guard when AxisItem maps extremely small ranges to tick coordinates
  • cover positive and zero-crossing subnormal ranges on both horizontal and vertical axes

Root cause

For a nonzero range near 1e-310, dividing a normal pixel width or height by that range overflows to infinity. The resulting Qt transform contains inf/nan, and AxisItem generates non-finite tick endpoints. This can cause platform-dependent rendering failures or crashes.

A fixed epsilon would change the visible scale of legitimate small-valued data. This change instead preserves the requested range and clamps only an already-overflowed ratio, retaining its sign. Ordinary scales and zero-range handling are unchanged.

Tests

  • focused ViewBox and AxisItem regression matrix: 8 passed
  • QT_QPA_PLATFORM=offscreen python -m pytest tests -q: 1094 passed, 723 skipped, 8 xfailed
  • repository pre-commit hooks for all four changed files: all applicable hooks passed; the removed upstream fix-encoding-pragma hook was skipped

Fixes #2370

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.

Very small range data can crash application due to divide by zero issues

1 participant