How to implement these math functions? i need them to be accurate down to the 1/10000, time for calculating isn't critical?