Hello friend.
I want to write a program whether a given point in the plane lies inside, outside, or on the boundary of a polygon. I have found this interesting website which shows 2 ways of doing that. i.e InsidePolygon() and pnpoly()
It requires to check is F(x,y)==0 for F describing a segment of the polygon, but as floating point calculations are imprecise, you will have to determine what precision is required and check abs(F(x,y)) < e instead.
it seems that relevand portion is
if (p1.x == p2.x || p.x <= xinters)
and you could use if (fabs(p.x-xinters)<epsilon) but this will not work on nearly horizontal segments.