Fix a few issues, add a couple tests

Fix floating point arithmetic issues and test whether the triangle is
behind the ray. The two tests I added failed without these changes.