Had an error with whole numbers as doubles getting inserted into the approximation function and inifinite loop