Square Root of a Number

easyBinary Searchmaths

You are given a number ( S ). Your task is to calculate its square root. The result may not necessarily be an integer.

Note: You are not allowed to use any libraries (such as <cmath> in C++ or math in Python) to compute the square root. You must implement the square root calculation manually.

Input Format:

The first and only line of input contains a single floating-point number $$$S$$$ ($$$0 < S \le 10^{18}$$$), representing the essence of the square.

Output Format:

Print a single floating-point number, the side length of the square. Your answer will be considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$.

Examples:

Example 1:

Input:

4

Output:

2.0000000000

Example 2:

Input:

0.5463572345

Output:

0.7391598166

Note:

Example 2:

This input tests the required $$$10^{-6}$$$ precision boundary, as an answer of 0.739158 would be marked wrong because its error is too large. The true value is $$$\sim$$$0.7391598, meaning answers like 0.739159 are accepted for being within the allowed tolerance.

Code

Loading Editor...