Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What's the difference between floating-point and integer in C language?
What's the difference between floating-point and integer in C language?
1. contains differences in types:

Integer types include byte, int, short, long,

Floating-point types include float (single precision) types and double constants.

2. Difference of value range: We can see that the maximum value of integer type is: 1, 844,674,407,370,955, 16 1, * * with 19 bits. The value range of float in floating point number is 39 bits 3.4E+38.

3. Difference in precision: Integer is an accurate numerical value, and floating-point number is often a seemingly value. For example, floating-point type only needs to ensure the accuracy of the first 6~7 digits. Such as: floating

f

=

123456789;

The values //8 and 9 may be inaccurate.

Extended data:

Other data types of C language:

I. Basic types

1, plastic type: int

, short

int,long

int,long

long

int(C99),char,bool

2. Floating point type: floating point

, double, double-precision floating-point (float _ complex, double _ complex, long

long_comples)

Second, the enumeration type

Enumeration type

Three, empty type

empty

Four. Derived type

Pointer type

*, array type

, structure type

Structure, * * * object type

Union, function type

Baidu Encyclopedia-Data Type