Php-manual Learning----"Language Reference"----"type"-----"float floating-point"

Source: Internet
Author: User

Notes:
1. Floating point (also known as floating-point float, double-digit or real-number) can be defined with any of the following syntax:
<?php
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>
2. The length of the floating-point number is relative to the platform, although the usual maximum value is 1.8e308 and has a precision of 14-bit decimal digits (64-bit IEEE format).
3. A rational number that can be accurately represented in decimal, such as 0.1 or 0.7, cannot be converted to binary format without losing a little bit of precision, regardless of how many of the mantissa can be accurately represented by the binary used internally. This can result in confusion: for example, floor ((0.1+0.7) *10 typically returns 7 instead of 8 as expected because the internal representation of the result is actually similar to 7.9999999999999991118 ....
4. So never believe that the floating-point number is accurate to the last one, and never compare two floating-point numbers for equality. If you do need a higher precision, you should use any mathematical or GMP function of any precision.
5.NaN
Some mathematical operations produce a result that is represented by a constant NAN. This result represents a value that is undefined or not expressed in a floating-point operation. Any loose or strictly comparable result of this value to any other value is FALSE.
Since Nan represents any different value, it should not be compared with other values, including itself, and should be checked with Is_nan ().




Php-manual Learning----"Language Reference"----"type"-----"float floating-point"

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.