karelklic / canal

Abstract interpreter for real-world application programs
https://github.com/karelklic/canal/wiki
Other
32 stars 3 forks source link

Handle division by zero in Set #145

Closed xbrukner closed 11 years ago

xbrukner commented 11 years ago

During cross product in Set, division by zero can happen, and it does in this program.

File: http://www.fi.muni.cz/~xbrukner/integration/pinky.c, http://www.fi.muni.cz/~xbrukner/integration/pinky.s

xbrukner commented 11 years ago

Chosen solution: assumption that programmer does not intentionally divide by zero. So unless the only value in divisor is zero (then result is top), we act as if there is no zero - ignore it in set and in interval use the neighboring value - either -1 or 1 in Integer::Interval or very small number larger or smaller than zero in Float::Interval. Same logic is used in remainder (in Set).