Usage of float type in PHP _ PHP Tutorial

Source: Internet
Author: User
Description of the float type in PHP. The float type can be represented by the following code :? Php $ a1.234; $ b1.2e3; $ c7E-10 ;? Note the following when using the float type of PHP: the float type of PHP precision float can be expressed as follows:

The code is as follows:


$ A = 1.234;
$ B = 1.2e3;
$ C = 7E-10;
?>


When using the float type of PHP, you must note that the float type of PHP is somewhat inaccurate. If you need high-precision mathematical computing, you can use the dedicated mathematical functions provided by php, arbitrary precision math functions series and gmp series functions. Also, do not try to compare variables of the float type.

Converting to float
For information on converting strings to float, see String conversion to numbers. for values of other types, the conversion is saved Med by converting the value to integer first and then to float. see Converting to integer for more information. as of PHP 5, a notice is thrown if an object is converted to float.

No translation. Haha

The pipeline code is as follows :? Php $ a = 1.234; $ B = 1.2e3; $ c = 7E-10 ;? Note the float type of PHP: precision of the float type of PHP...

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.