MtnViewJohn/context-free

Detect division by zero

Closed this issue · 2 comments

Division by zero isn't detected.
The following sample code produces an error message A shape got too big. with version 3.0.11.3(v28).

startshape myshape
shape myshape{
    SQUARE[r (180/0)]
}

Individual calculations are not checked for infinity/NaN. But the world state of each shape is checked for infinity/NaN before it is accepted by the rendering algorithm. Shapes that have infinity/NaN are dropped and this warning message is printed.

The warning says 'too big' because that is the typical reason why the infinity/NaN is there. But you are right, there are other reasons why the shape could have infinity/NaN and the warning should be more generalized. At the time of the check, Context Free has no idea what went wrong. It just knows that the shape is not well defined.

Fixed in version 3.1