Fix floating point math errors #7

review? @digitarald