Changed algorithm to use doubles

Use doubles in order to account for better curve, more accurate numbers