The sqrt function in How to use sqrt function is used to return the square root of a number, which is the square root. In the following article, we will take a closer look at how to use the sqrt function.
Let’s take a look at the basic syntax of thesqrt function
Math.sqrt(value)
The square root number needs to be calculated.
Returns the square root of the number passed as argument.
It should be noted that:
1. A non-numeric string passed as a parameter returns NaN
2. An array of more than 1 integer passed as a parameter returns NaN
3. Negative numbers passed as parameters return NaN
4. Empty strings passed as parameters return NaN
5. Empty arrays passed as parameters return NaN
Let’s look at the specific examples
The code is as follows
The execution results are as follows
1.4142135623730951 1.6 NaN NaN 16
This article ends here, more exciting content for you You can pay attention to other related column tutorials on the PHP Chinese website! ! !
The above is the detailed content of How to use sqrt function. For more information, please follow other related articles on the PHP Chinese website!