PHP | bcpow() Function Last Updated : 19 Apr, 2018 Comments Improve Suggest changes Like Article Like Report The bcpow() function in PHP is an inbuilt function and is used to calculate the value of an arbitrary precision base number raised to another exponent number. This function accepts two arbitrary precision numbers as strings and returns the base number raised to exponent after scaling the result to a specified precision. Syntax: string bcpow ( $base, $exponent, $scaleVal ) Parameters: This function accepts three parameters as shown in the above syntax and explained below: $base: This parameter is of string type and represents the base in which the power will be raised. This parameter is mandatory. $exponent: This parameter is of string type and represents the exponent. This parameter is mandatory. $scaleVal: This parameter is of int type and is optional. This parameter tells the number of digits that will appear after the decimal in the result of baseexponent. It's default value is zero. Return Value: This function returns the $base$exponent result as string. Examples: Input: $base = 2, $exponent = 3 Output: 8 Since the parameter $scaleVal is not specified so no digits after decimal is appeared in the result after evaluating result Input: $base = 2, $exponent = 3, $scaleVal = 2 Output: 8 Note: Instead of 8.00, output of 8 is given. This is an exception in bc math functions. Below programs illustrate the bcpow() function in PHP : Program 1: php <?php // PHP program to illustrate bcpow() function // input numbers with arbitrary precision $base = "2"; $exponent = "3"; // calculates the base^exponent // the two numbers when $scaleVal is // not specified $res = bcpow($base, $exponent); echo $res; ?> Output: 2 Program 2: php <?php // PHP program to illustrate bcpow() function // input numbers with arbitrary precision $base = "2"; $exponent = "3"; // scale value $scaleVal = 4; // calculates the base^exponent // the two numbers when $scaleVal is // specified $res = bcpow($base, $exponent, $scaleVal); echo $res; ?> Output: 2 Reference: http://php.net/manual/en/function.bcpow.php Comment More infoAdvertise with us Next Article PHP | bcpow() Function C ChetnaAgarwal Follow Improve Article Tags : Web Technologies PHP PHP-bc Similar Reads PHP | bcpowmod() Function The bcpowmod() function in PHP is an inbuilt function and is used to raise an arbitrary precision base number to another exponent number reduced by a specified modulus. This function accepts three arbitrary precision numbers as strings and returns the base number raised to exponent modulo under a nu 2 min read PHP | bcmod() Function The bcmod() function in PHP is an inbuilt function and is used to calculate modulus of an arbitrary precision numbers. This function accepts an arbitrary precision number and returns the modulus of that number after scaling the result to a specified precision. Syntax: string bcadd ( $dividend, $modu 2 min read PHP cos( ) Function Trigonometry is an important part of mathematics and PHPâs math functions provides us with some functions which are very useful for calculations involving trigonometry. The cos()function in PHP is used to find the cosine of a number. The cos() function returns a float value between -1 and 1, which r 2 min read PHP | bccomp() Function The bccomp() function in PHP is an inbuilt function and is used to compare two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the result of comparison of the two numbers after comparing them upto a specified precision. Syntax: int bccomp ( $ 3 min read PHP acos( ) Function Trigonometry is an important part of mathematics and PHPâs math functions provides us with some functions which are very useful for calculations involving trigonometry. One of such function is acos() function. The acos() function in PHP is used to find the arc cosine of a number in radians. We alrea 2 min read PHP cosh( ) Function The cosh() function is a builtin function in PHP and is used to find the hyperbolic sine of an angle. The hyperbolic cosine of any argument arg is defined as, (exp(arg) + exp(-arg))/2 Where, exp() is the exponential function and returns e raised to the power of argument passed to it. For example exp 2 min read PHP | bcdiv() Function The bcdiv() function in PHP is an inbuilt function and is used to divide two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the division of the two numbers after scaling the result to a specified precision. Syntax: string bcdiv ( $num_str1, 2 min read PHP | bcmul() Function The bcmul() function in PHP is an inbuilt function and is used to multiply two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the multiplication of the two numbers after scaling the result to a specified precision. Syntax: string bcmul ( $nu 2 min read PHP | bcadd() Function The bcadd() function in PHP is an inbuilt function and is used to add two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the addition of the two numbers after scaling the result to a specified precision. Syntax: string bcadd ( $num_str1, $nu 2 min read Like