C language float type has several significant digits after the decimal point
This article mainly introduces "there are several valid digits after the decimal point of the float type of the c language". In the daily operation, I believe that many people have doubts about the number of valid digits after the decimal point of the float type of the c language. The editor has consulted all kinds of data and sorted out a simple and useful method of operation. I hope it will be helpful for everyone to answer the doubt that there are several valid digits after the decimal point of the float type of the c language. Next, please follow the editor to study!
C language float type how many significant digits are there after the decimal point?
The valid digits after the decimal point of the float type are 6-7 digits.
The floating point type in C language is generally divided into float single precision type, double double precision type and long double long precision type. The effective digits after the single precision floating point and double precision floating point are 67.7 digits and 1516digits respectively. Single precision is 32 bits, double precision is 64 bits, and 8 bits is one byte.
The number of significant digits after the floating point is defined in the C language standard library header file float.h:
/ / part of the code of the float. H header file # define DBL_DIG 15 / / 15 places after the double precision decimal point # define FLT_DIG 6 / / 6 places after the single precision decimal point # define LDBL_DIG 19 / / long double precision decimal point 19
At this point, the study of "there are several valid digits after the decimal point of the float type of c language" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!