PHP | bcscale() Function Last Updated : 19 Apr, 2018 Comments Improve Suggest changes Like Article Like Report The bcscale() function is an inbuilt function in PHP. It sets the default scale parameters for all bc math function calls. When we call the function bcscale() in a program, the parameter passed in this function thus becomes the default scale factor which by default is zero. Syntax: int bcscale($scale) Parameters: This function accepts a single parameter $scale and is of int type and is mandatory. This parameter tells the number of digits that will appear after the decimal in the result of function call of all bc math functions. Its default value is zero. Return Value: This function returns the old scale value. Below programs illustrate the bcscale() function in PHP : Program 1: php <?php // default scale : 3 bcscale(3); // takes the default scale value as 3 // which is declared at the beginning echo bcadd('111', '6.55957'), "\n"; // 16.007 // this is not the same without bcscale() echo bcadd('111', '6.55957', 1), "\n"; // 16.007 // takes the default scale value as 3 // which is declared at the beginning echo bcadd('111', '6.55957'), "\n"; ?> Output: 117.559 117.5 117.559 Program 2: php <?php // default scale : 3 bcscale(5); // takes the default scale value as 3 // which is declared at the beginning echo bcadd('111', '6.55957'), "\n"; // 16.007 // this is not the same without bcscale() echo bcadd('111', '6.55957', 1), "\n"; // 16.007 // default scale value changes bcscale(2); // takes the default scale value as 2 // which is declared echo bcadd('111', '6.55957'), "\n"; ?> Output: 117.55957 117.5 117.55 Reference: http://php.net/manual/en/function.bcscale.php Comment More infoAdvertise with us Next Article PHP | bcscale() Function C ChetnaAgarwal Follow Improve Article Tags : Misc Web Technologies PHP PHP-bc Practice Tags : Misc Similar Reads 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 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 | bcsqrt() Function The bcsqrt() function in PHP is an inbuilt function and is used to evaluate the square root of an arbitrary precision number. This function accepts an arbitrary precision number as a string and returns the square root of the number after scaling the result to a specified precision. Syntax: string bc 2 min read PHP ceil( ) Function We have often used the ceiling function in mathematical problems to round up a decimal number to next greater integral value. PHP provides us with a built-in function ceil() to perform such operation. The ceil() function is a built-in function in PHP and is used to round a number to the nearest grea 1 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 | bcpow() Function 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 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 | 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 Like