In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What is the data type of float? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Float is a floating-point data type used to store single-precision or double-precision floating-point numbers. The single-precision value of the floating-point type has 4 bytes, including a symbol bit, an 8-bit binary index, and a 23-bit Mantissa. Because the high sequence bit of the Mantissa is always 1, it is not stored as a number.
Float is a floating-point data type.
The FLOAT data type is used to store single-or double-precision floating-point numbers. Floating point numbers use the IEEE (Society of Electrical and Electronic Engineers) format. A single-precision value of a floating-point type has 4 bytes, including a symbol bit, an 8-bit binary index, and a 23-bit Mantissa. Because the high order bit of the Mantissa is always 1, it is not stored in digital form. This representation provides a range of roughly between-3.4E+38 and 3.4E+38 for float types.
Constitute
Floating-point numbers are expressed in exponential form in the machine and are divided into four parts: number symbol, Mantissa, index symbol and index.
The number symbol occupies 1-bit binary, indicating the positive or negative of the number.
The index symbol occupies a 1-bit binary, indicating the positive or negative of the index.
The Mantissa represents a floating-point significant number, 0.xxxxxxx, but does not store the first zero and dot.
The index stores the valid number of the index.
The number of digits of the index and the Mantissa are determined by the computer system.
Difference
Variables can be declared as float or double according to the needs of the application. The main difference between the two types is the cardinality they can represent, the storage they need, and their range.
Value range
Floating-point variables are represented by Mantissa (the value containing the number) and exponent (the order of magnitude containing the number).
The following table shows the number of Mantissa and exponent digits assigned to each floating point type. The most significant bit of any float or double is always the symbol bit. If the symbol bit is 1, the number is treated as negative; otherwise, the number is treated as positive.
Index and Mantissa
Because the index is stored in unsigned form, the deviation of the index is half of its possible value. For float type, the deviation is 127; for double type, the deviation is 1023. You can calculate the actual index value by subtracting the deviation value.
The Mantissa stored as a binary score is greater than or equal to 1 and less than 2. For float and double types, there is an implicit leading 1 in the Mantissa of the most significant bit position, so that the Mantissa is actually 24 and 53 bits long, respectively, even if the most significant bit has never been stored in memory.
A floating-point packet can store binary floating-point numbers as non-standardized numbers instead of using the storage method just described. A non-standardized number is a non-zero floating-point number with a reserved index value, where the most significant digit of the Mantissa is 0. By using a non-standardized format, the range of floating-point numbers can be extended, but the precision is lost. You cannot control whether floating-point numbers are represented in standardized or non-standardized form; floating-point packages determine the representation. Floating-point packages never use a non-standardized form unless the index becomes less than the minimum value that can be expressed in a standardized form.
The following table shows the minimum and maximum values that can be stored in variables of each floating point type. The values listed in this table apply only to standardized floating-point numbers; the minimum value for non-standardized floating-point numbers is even smaller. Note that numbers retained in 80x87 registers are always represented in 80-bit normalized form; numbers can only be represented in non-standardized form when stored in 32-bit or 64-bit floating-point variables (variables of type float and long).
This is the answer to the question about what the data type of float is. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.