Looking at a PHP question, I don't know why. ask someone to solve it.
Source: Internet
Author: User
I was surprised to see a PHP question, but I couldn't understand why. I was surprised to ask GAO to first check what the output result was and then try again... Find the cause .. & Lt ;? $ V1 = 60.06; $ v2 = 60.05 + 0.01; if ($ v1 = $ v2) echo & quot; equal & quot; elseecho & q see a PHP question, I don't know the reason. please wait.
It would be surprising to first check what the output result is and then try again... Find the cause ..
------ Solution --------------------
They are not equal.
If the first is not equal, the second is not equal.
This involves the storage of floating point numbers, which are not precisely stored.
------ Solution --------------------
Add double quotation marks to $ v2 for a long time.
If ($ v1 = "$ v2 ")
------ Solution --------------------
The landlord should check the post on the top of this version. There are FAQs in this section.
------ Solution --------------------
Data type issues.
------ Solution --------------------
This is the problem of floating point storage. LZ can see the floating point of basic programming.
------ Solution --------------------
Http://www.enjoyphp.com/2011/development/php/float-cm/
Read this article,
------ Solution --------------------
The exact bit problem later,
Score
------ Solution --------------------
I have never tried this!
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