#How many significant digits are there after the decimal point for float type in C language?
The valid digits after the decimal point for float type are 6~7.
Floating point types in C language are generally divided into float single precision type, double double precision type, and long double long precision type. The effective digits after the decimal point of single precision floating point type are 6~7 digits and double precision floating point type. The number of valid digits after the decimal point is 15 to 16 digits. Single precision is 32 bits, double precision is 64 bits, and 8 bits are one byte.
The C language standard library header file float.h defines the number of significant digits after the decimal point of floating point numbers:
//float.h头文件的部分代码 #define DBL_DIG 15 //双精度小数点后15位 #define FLT_DIG 6 //单精度小数点后6位 #define LDBL_DIG 19 //长双精度小数点19
Recommended learning: c language video tutorial
The above is the detailed content of How many significant digits are there after the decimal point for float type in C language?. For more information, please follow other related articles on the PHP Chinese website!