Coders Packet

Precise Square root using cpp

By M.Sivarama Chandran

We are finding the floating part of the square root of a given number, to get the exact precise value of the square root.

In this tutorial, we will learn how to write the program to get the floating values of the square root of a given number...                            

                                   GET THE FLOATING PART OF A SQUARE ROOT VALUE

This is a cpp program used to calculate the precise value of the square root of a given number.

Through this program, the user can get the square root's precise value (i.e., the user can get the desired floating value after the decimal.)  

In this program, two functions are developed...

1. sqrtInteger() - Through this function, the user can pass the desired value as an argument to get the integer value of the square root. This function uses the concept of binary search to calculate the value. This can be finished under the O(logn) time complexity, much less than any other program.

2. More precise ()-This function is the main motto of this program. Through this function, the user can get the desired floating values after the decimal part. This is just based on a simple double-for-loop game. 

        

       DEMO PICTURES

         CODE 

          DEMO 1

          DEMO 2

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by M.Sivarama Chandran (Ramu)

Download packets of source code on Coders Packet