Bend
Bend copied to clipboard
Divide by zero error without dividing by zero
I get the following error message on bend version 0.2.7 running with bend run test.bend
attempt to divide by zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
exit status: 101
The error is caused by
def normalize_coord(coord, width, height):
(x, y) = coord
return ( x / width, y / height)
However, width and height are never zero. Rewriting as
def normalize_coord(coord, width, height):
(x, y) = coord
return ( x / 4, y / 4)
yields no error. The full code is test.zip