Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
I suggest using fast exponentiation technique (exponentiation by squaring) for the whole number portion. We can utilize the same technique for the decimal portion; however, this time every time we move one digit forward in base 2 representation of the decimal portion, we calculate the square root of the previous step using babylonian method, or any other efficient method.
You can easily do a loop for the whole number portion of y. For the decimal portion that's more math and log than programming
- Anonymous April 16, 2014