Skip to content

MLR106: Literal NaN/inf flows into mobject geometry

qual reports MLR106 when a confirmed non-finite value reaches a knowledge-resolved mobject constructor or a curated fluent geometry method (shift, move_to, scale, rotate, next_to, to_edge):

  • a float("nan") / float("inf") / float("-inf") call (case-insensitive, builtin float not shadowed in the file);
  • an attribute resolving to math.inf / math.nan (math.inf, import math as m; m.nan);
  • a bare name bound exactly once by from math import inf/nan [as alias] and never rebound in the file.

  • Default severity: error

  • Minimum confidence: high
  • Implementation phase: 1
  • Fix: none

NaN and infinity propagate through the points array: bounding boxes, alignment, and camera transforms become non-finite, so the mobject disappears or the renderer crashes far from the source of the value. Values that merely might be non-finite (helper calls, arithmetic, unknown names) never fire.

Wrong:

Dot(float("inf"))
square.shift(math.nan)

Right:

Dot(RIGHT * 3)
square.shift(offset)   # unknown value: not reported