PHP - gmp_sqrt() Function



Definition and Usage

The gmp_sqrt() function calculates the square root.

Description

The gmp_sqrt() calculates square root for the given GMP number.

Syntax

 gmp_sqrt ( GMP $a ) : GMP 

Parameters

Sr.No Parameter & Description
1

a

It can a GMP resource number , a gmp object or a numeric string.

Return Values

PHP gmp_sqrt() function returns square root as GMP number.

PHP Version

This function will work from PHP Version greater than 5.0.0.

Example 1

Working of gmp_sqrt −

 <?php $sqrt = gmp_sqrt("102400"); echo "The Square root of 102400 is :".$sqrt; ?> 

This will produce following result −

 The Square root of 102400 is :320 

Example 2

Working of gmp_sqrt −

 <?php $sqrt = gmp_sqrt("979662468841"); echo "The Square root of 979662468841 is :".$sqrt; ?> 

This will produce following result −

 The Square root of 979662468841 is :989779 
php_function_reference.htm
Advertisements