KingOfActing
lukewarm mess
Re: HSC 2016 4U Marathon
Oh, the other idea I had but didn't bother to try and see if it was more viable (probably is) was to find a polynomial that very accurately approximated the square root function on some small range (Something like 1-4?) and then recursively force the input into that range.
A simple outline:
Where minMax was the accurate polynomial (or any other accurate, fast function) to approximate the square root of a number in the range 1 <= x <= 4.
Oh, the other idea I had but didn't bother to try and see if it was more viable (probably is) was to find a polynomial that very accurately approximated the square root function on some small range (Something like 1-4?) and then recursively force the input into that range.
A simple outline:
Code:
sqrt(input x)
{
if(x < 0) throw error;
if(x == 0) return 0;
if(x < 1) return sqrt(4*x)/2;
if(x > 4) return sqrt(x/4)*2;
return minMaxPolynomial(x);
}