my $EPSILON = 1e-20; my $asum = GreenTheoremTest($poly); if (abs($asum) < $EPSILON) { print "Polygon area is too small to be sure of direction!\n"; } elsif ($asum < 0.0) { print "Polygon is clockwise\n"; } else { print "Polygon is counterclockwise\n"; }