Php precise computing module BCMath

Source: Internet
Author: User
Php: BCMathbc 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, Php: BCMath 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. Here, the large number is represented by a string consisting of 0-9, and the return value is also a string. Bcadd-add two high-precision numbers together bccomp-compare two high-precision numbers, return-1, 0, 1 bcdiv-remove two high-precision numbers from bcmod-calculate the high-precision digital remainder bcmul-multiply two high-precision numbers by bcpow-calculate the high-precision digital multiplier bcpowmod-calculate the high-precision digital multiplier modulo, bcscale is very common in number theory-the default number of decimal places is configured, it is equivalent to "scale =" bcsqrt in Linux bc-evaluate the high-precision digital square root bcsub-subtract two high-precision numbers. you can refer to the manual to check the application of these functions. Bcmath installation bcmath this extension in php compressed package are some, need to re-compile to support; 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) copy the so path to the extension path vim php. ini extension = bcmath. so restart apach PHP code? /* The bcsub function indicates that this function subtract two high-precision numbers and transmits them into 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 a decimal point of $ aa = bcsub (134.7, 52.5, 1); echo $ aa; // exit; $ bb = bcsub ($ aa, 82.2, 1); echo $ bb; // exit ;//

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.