Does this line pass through that square? Divide the first quadrant (including the positive x-axis, the positive y-axis, and the origin) into 1x1 grids, with each grid labelled by the coordinates of its bottom-left corner, as demonstrated below:



Note that each grid contains its boundaries and its vertices. Using mathematical symbols, the grid labelled (m,n) would represent the square {(x,y) | m ≤ x ≤ m+1, n ≤ y ≤ n+1}.



Given a straight line in the form of ax+by+c=0 with integers a, b, and c, and a grid represented by (m,n), output whether the line passes through the grid, i.e. whether any point in the given grid is on the line.



a  b  c m n output
1  1  0 0 0 true
1  1  0 1 1 false
1  1  0 0 2 false
1  1 -3 0 1 true
1  1 -3 0 0 false
2 -1  0 1 1 true
2 -1  0 1 0 false
2 -1  0 0 2 true
2 -1  0 0 1 true
2 -1  0 1 2 true
2  0 -1 0 0 true
2  0 -1 0 1 true
2  0 -1 0 2 true
2  0 -1 1 0 false
2  0 -1 1 1 false
0  2 -1 0 0 true
0  2 -1 1 0 true
0  2 -1 2 0 true
0  2 -1 0 1 false
0  2 -1 1 1 false
1  0 -1 0 0 true
1  0 -1 0 1 true
1  0 -1 0 2 true
1  0 -1 1 0 true
1  0 -1 1 1 true


Please suggest more testcases in the comments.



This is code-golf. Shortest answer in bytes wins. Standard loopholes apply.
Python 3, 84 66 bytes

First golf, first fail (maybe).

Thanks to Rod for shaving off 18 bytes by using a function instead of direct input.

def f(a,b,c,m,n):f=-(a*m+c)/b;g=f-a/b;print(min(f,g)&lt;=n&lt;=max(f,g))


Try it online!

Explanation:

Basically we calculate the value of the line function for m and m+1, if n is inbetween the values, then the list must pass through it at some point.
Would be much better if the language had some simpler way to input multiple integers.