Given a 32 bit floating point number x stored in IEEE 754 floating point format, find inverse square root of x, i.e., x-1/2.
A simple solution is to do floating point arithmetic. Following is example function.
1.41421 0.527046 1
Following is a fast and interesting method based for the same. See this for detailed explanation.
1.41386 0.526715 0.998307
This article is contributed by Shalki Agarwal. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
In case you wish to attend live classes with industry experts, please refer DSA Live Classes