How many significant digits are there after the decimal point for float type in C language?

angryTom
Release: 2020-02-08 14:02:35
Original
19383 people have browsed it

How many significant digits are there after the decimal point for float type in C language?

#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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!