PhpBC high-precision function library _ PHP Tutorial

Source: Internet
Author: User
PhpBC high-precision function library. PhpBC high-precision function library $ right returns 1 * $ scale decimal place *************************** **************************************** * ******************* $ a4.45; $ b5.54; if (bc php BC high-precision function library

 $ Right returns 1 * $ scale decimal place ******************************* **************************************** * *************** $ a = 4.45; $ B = 5.54; if (bccomp ($ a, $ B, 2) = 0) {}************************************** **************************************** * ******** add two high-precision numbers * string bcadd (string $ left_operand, string $ right_operand [, int $ scale]) * $ scale returns the number of decimal places ********************************** ********** **************************************** * ** $ A = 1.0321456; $ B = 0.0123456; $ c = bcadd ($ a, $ B, 2); // var_dump ($ c ); **************************************** **************************************** * ****** subtraction of two high-precision numbers * sstring bcsub (string $ left_operand, string $ right_operand [, int $ scale]) * $ scale returns the number of decimal places ********************************** **************************************** * ************ $ a = 1. 0321456; $ B = 3.0123456; $ c = bcsub ($ a, $ B, 2); var_dump ($ c ); **************************************** * **************** remainder/modulo of two high-precision computations * string bcmod (string $ left_operand, string $ modulus) **************************************** * ************** $ a = 6; $ B = 4; $ c = bcmod ($ a, $ B); // var_dump ($ c ); **************************************** **************************************** * ****** division of two high-precision numbers * string bcp (String $ left_operand, string $ right_operand [, int $ scale]) * $ scale indicates the number of decimal places. the default value is 0 ******************************** **************************************** * ************** $ a = 6; $ B = 5; $ c = bcp ($ a, $ B, 3); // var_dump ($ c ); **************************************** **************************************** * ****** multiply two high-precision numbers * string bcmul (string $ left_operand, string $ right_operand [, int $ scale]) * $ Scale indicates the number of decimal places. the default value is 0 ******************************** **************************************** * ************** $ a = 3.1415926; $ B = 2.4569874566; $ c = bcmul ($ a, $ B, 6); // var_dump ($ c ); **************************************** **************************************** * ****** the power of two high-precision numbers * string bcpow (string $ left_operand, string $ right_operand [, int $ scale]) * $ scale indicates the number of decimal places. the default value is 0 ************************** **************************************** * ******************** $ A = 3.1415926; $ B = 2; $ c = bcpow ($ a, $ B, 3); // var_dump ($ c ); **************************************** * ********* calculate the square root of a precise number * string bcsqrt (string $ operand [, int $ scale]) * $ scale indicates the number of decimal places. the default value is 0 ******************************** * ****************** $ B = bcsqrt ($, 6); // var_dump ($ B ); * ***************************** set the decimal point of the bc function * bool bcscale (I Nt $ scale) * $ scale the number of decimal places is 0 ******************************// bcscale () ;?>


Http://www.bkjia.com/PHPjc/1015088.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1015088.htmlTechArticlephp BC high precision function library $ right returns 1 * $ scale decimal place ************************** **************************************** * ******************** $ a = 4.45; $ B = 5.54; if (bc...

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.