In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces php floating point refers to what is meant, the text is very detailed, has a certain reference value, interested friends must read!
php Float refers to the Float type, also known as float, double, or real, and is defined using syntax such as "$a = 1.234;$b = 1.2e3;"; floating-point numbers have platform-dependent word lengths, although they usually have a maximum value of 1.8e308 and precision of 14 decimal digits.
Operating environment: Windows 7 system, PHP7.1 version, DELL G3 computer
What does PHP mean by floating point?
Float
Floating-point types (also known as floating-point float, double-precision double, or real) can be defined using any of the following syntax:
Formal representation of floating-point numbers (underscore not supported before PHP 7.4.0):
LNUM [0-9]+(_[0-9]+)*DNUM ([0-9]*(_[0-9]+)*[\.] {LNUM}) | ({LNUM}[\.] [0-9]*(_[0-9]+)*)EXPONENT_DNUM (({LNUM} | {DNUM}) [eE][+-]? {LNUM})
Floating-point numbers have platform-dependent word sizes, although they usually have a maximum value of 1.8e308 and precision of 14 decimal digits (64-bit IEEE format).
precision of floating-point numbers
Floating-point numbers have limited precision. Although PHP typically uses IEEE 754 double precision format depending on the system, the maximum relative error due to rounding is 1.11e-16. Non-elementary mathematical operations may give larger errors and account for error propagation when performing compound operations.
Furthermore, rational numbers such as 0.1 or 0.7, which can be accurately represented in decimal, cannot be accurately represented by the binary used internally, no matter how many mantissas they have, and therefore cannot be converted to binary format without losing a little precision. This can lead to confusing results: for example, floor((0.1+0.7)*10) usually returns 7 instead of the expected 8, because the internal representation of the result is something like 7.99999999999991118...
So never trust floating-point results to the last digit, and never compare two floating-point numbers for equality. If higher precision is really needed, use arbitrary precision math functions or gmp functions.
The above is "php floating point refers to what means" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.