gmp_rootrem() function in PHP



The gmp_rootrem() function is used to calculate the nth root of a GMP number. It returns the integer component of the nth root and remainder.

Syntax

gmp_rootrem($n,$root)

Parameters

  • n − It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

  • root − The root of the number n

Return

The gmp_rootrem()function returns the integer component of the nth root and remainder.

Example

The following is an example −

<?php
   $num = gmp_init(15);
   $root = 2;
   $res = gmp_rootrem($num, $n);
   print_r($res);
?>

Output

The following is the output −

Array
(
   [0] => GMP Object ( [num] => 3 )
   [1] => GMP Object ( [num] =>6 )
)
Updated on: 2019-12-31T07:01:47+05:30

85 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements