Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to find the maximum value in C language

Shulou Source: shulou.com Published: 2022-06-02 07:38:17 10月03日 Update

It is believed that many inexperienced people do not know what to do about how to find the maximum value in C language. therefore, this paper summarizes the causes and solutions of the problem. I hope you can solve this problem through this article.

Everyone should know the minimum and maximum values of integers.

What about floating point numbers? It's a little complicated! And in any interval, the number of floating points is infinite. So the floating point represented in the computer must be jumping.

The maximum value of float (sign 1, index 8, Mantissa 23) is as follows

111111111 the 23 digits of the Mantissa are not all 0, for example, 0xFF800001: is not a numeric value, and NaN is used to represent an invalid value in VxWorks.

1111111000000000000000000000 = 0xFF800000: negative infinity, infinity is represented by Inf in VxWorks

111111110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

100000001000000000000000000000 = 0x80800000: represents the largest negative number, that is,-2-126, which is approximately equal to-1.175494mm 10-38, but the precision of printf is limited, so it is generally displayed as 0.

000000000000000000000000000000000000 = 0x00000000: indicates 0

000000001000000000000000000000 = 0x00800000: represents the smallest positive number, that is, 2-126, which is approximately equal to 1.17549410-38

011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

0111111000000000000000000000 = 0x7F800000: indicates positive infinity

The 23 digits of the Mantissa of 011111111 are not all 0, for example, 0x7F800001: indicates that it is not a numeric value

The maximum value of double (sign 1, index 11, and Mantissa 52) is as follows

The 52 digits of the Mantissa of 1111111111 are not all 0, for example, 0xFFF0000000000001: indicates that it is not a numeric value

The 52 digits of 111111111111 Mantissa are all 0 = 0xFFF0000000000000: indicates negative infinity

The 52 digits of the Mantissa of 1111111110 are all 1 = 0xFFEFFFFFFFFFFFFF: indicates the smallest negative number, that is,-21024, which is approximately equal to-1.797693mm 10308

The 52 digits of the Mantissa 1000000001 are all 0 = 0x8010000000000000: indicates the largest negative number, that is,-2-1022, which is approximately equal to-2.225074-10-308

The 52 digits of 000000000000 Mantissa are all 0 = 0x0000000000000000: indicates 0

The 52 digits of the Mantissa 00000001 are all 0 = 0x0010000000000000: the smallest positive number, that is, 2-1022, which is about 2.225074-10-308.

The 52 digits of the Mantissa 0111111110 are all 1 = 0x7FEFFFFFFFFFFFFF: indicates the largest positive number, that is, 21024, which is about 1.797693 / 10308.

The 52 digits of the Mantissa 0111111111 are all 0 = 0x7FF0000000000000: indicates positive infinity

The 52 digits of the Mantissa of 0111111111 are not all 0, for example, 0x7FF0000000000001: indicates that it is not a numeric value

After reading the above, have you mastered the method of finding the best value in C language? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Mantissa maximum minimum numerical infinity positive negative language Chinese content decimal index method more floating point symbol problem complex helpless for this reason Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux macOS Shulou Information MySQL