Welcome to the Linux community forum and interact with 2 million technicians. bc is short for BinaryCalculator. Bc * function parameters are all operands plus an optional [intscale], such as stringbcadd (string $ left_operand, string $ right_operand [, int $ scale]). If scale is not provided, bcsc
Welcome to the Linux community forum and interact with 2 million technicians> enter bc, short for Binary Calculator. Bc * function parameters are all operands plus an optional [int scale], such as string bcadd (string $ left_operand, string $ right_operand [, int $ scale]). If scale is not provided, bcsc
Welcome to the Linux community forum and interact with 2 million technicians>
Bc is short for Binary Calculator. Bc * function parameters are all operands plus an optional [int scale], such as string bcadd (string $ left_operand, string $ right_operand [, int $ scale]). If scale is not provided, use the default value of bcscale. The large number is expressed by a string consisting of 0-9, and the return value is also a string.
Bcadd-add two high-precision numbers
Bccomp-compare two high-precision numbers and return-1, 0, 1
Bcp-division of two high-precision numbers
Bcmod-precise digital Remainder
Bcmul-multiply two high-precision numbers
Bcpow-calculate a high-precision digital Multiplier
Bcpowmod-modulus of high-precision multiplication of numbers, which is very common in number theory.
Bcscale-configure the default decimal place, which is equivalent to "scale =" in Linux bc"
Bcsqrt-calculate the square root of a precise number
Bcsub-Subtract two high-precision numbers
You can refer to the Manual to check the application of these functions.
Bcmath Installation
Bcmath extensions are available in php compressed packages and need to be re-compiled to support them;
Cd php-5.2.7/ext/bcmath
/Usr/local/php/bin/phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config
Make & make install (make can get the so path)
So path copy to extension path
Vim php. ini
Extension = bcmath. so
Restart apach
PHP code?
/* Bcsub Function Description
This function subtract two high-precision numbers and input two strings, minus the right operand value on the left. Scale is an optional option, indicating the return value? The number of digits required after the decimal point. */
// The following Code ensures that the decimal point is one digit.
$ Aa = bcsub (134.7, 52.5, 1 );
Echo $ aa; // exit;
$ Bb = bcsub ($ aa, 82.2, 1 );
Echo $ bb; // exit;
//