Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Real type includes shaping.
Real type includes shaping.
Real variables in C language are divided into two types, they are () and () floating-point and double real variables.

Real variables are divided into single precision and double precision, and their type descriptors are floating-point single precision descriptors and double precision descriptors. In Turbo C, the single-precision type occupies 4 bytes (32 bits) of memory space, and its numerical range is 3.4e-38 ~ 3.4e+38, and only 7 significant digits can be provided. Double-precision type occupies 8 bytes (64 bits) of memory space, and its numerical range is1.7e-308 ~1.7e+308, which can provide 16 significant digits.

The format and writing rules of real variable description are the same as those of integers.

For example: float x, y; (x, y are single-precision real numbers)

Double a, b, c; (A, B and C are double-precision real quantities)

Real constants, whether single precision or double precision, are regarded as double precision and double type.

void main(){

Floating a;

Double b;

a = 33333.33333

b = 33333.33333333333333

printf("%f\n%f\n ",a,b);

}

In C language, there are two kinds of real variables, namely _ _ _ _ _ _ _ _ _ _ _. Floating type and double type

What are the two types of real variables in C language? Floating point and double precision

In C language, real variables are divided into floating-point and double-precision types, stored as floating-point numbers, and divided into numbers, _ _ _ _ _ _ and _ _ _ _ _. In C language, real variables are divided into floating-point type and double-precision type, which are stored as floating-point numbers and divided into numbers, rank codes and mantissas.

In C language, real variables are divided into floating-point type and double-precision type, stored as floating-point numbers, and divided into digital symbols, _ _ _ and mantissa. Step code. Used to indicate the position of decimal point in a number, which is a signed integer.

Is the real variable positive or negative in C language? Real variable! ! ! ! ! !

What is a real variable and ASCII code is removed? Only characters and single characters are "represented" by ASCII encoding.

Double float type is unsigned, even if it is defined as unsigned double and unsigned float, it is wrong! The compiler will not report an error, but the output result will definitely make you feel puzzled!

The difference between double-precision real variables and long-precision real variables in C language: double-precision real variables and long-precision real variables: this is not always different.

Long double precision is not lower than double precision.

In early VC, Dragon double was an alias of double.

In modern X86 compilers, double is generally a 64-bit floating-point number, and long double is generally an 80-bit floating-point number.

For other platforms, double and long double have different interpretations, and generally need to be similar to sizeof to determine the meaning of long double in the system.

In 80x86 system, 80x87 itself is an 80-bit floating-point coprocessor, so generally long double corresponds to 80-bit floating-point number, but a few systems are 128-bit floating-point number or 64-bit floating-point number. Double is generally a 64-bit floating-point number, which is obtained by truncating the following result by 80x87. Although it is an 80-bit floating-point number, it may occupy the storage space of 10, 12 or 16 bytes, depending on the compiler.

No wealth value, pure studious, I hope China can enjoy the resources * * *-"The spirit of enjoying * * * should be that you want to accumulate wealth value, right?

Generally speaking, what we call * * * enjoyment is two-way, and "coming without being indecent".

One-way spirit that is not enjoyed by * *.

Why are integer variables output as real variables as 0 in C language? 1. Integers and floating-point numbers have different storage formats and layouts in memory (please refer to blog.csdn./songjin/article/details/7753777 for the memory layout and representation of floating-point numbers).

2. When putting parameters on the stack, printf puts parameters on the stack according to the type of actual parameters, not according to the type specified in the formatting characters. The specific stacking process is as follows. As a result, the types of parameters put on the stack do not match the types used by the actual functions (the key point is that the occupied memory size is different), so the results mentioned in the title will appear in the specific analysis, because the memory layout will be very small when shaping is parsed into floating-point numbers, because shaping was originally stored in 4 bytes, but it was parsed into 8-byte floating-point numbers, so the value obtained will be very small, just as floating-point numbers indicate: denormalization: when all binary bits of e are 0, n,

Note that the hidden bit to the left of the decimal point is 0. Why e equals (1-bias) instead of (-bias) is mainly designed for the smooth transition between normalized and denormalized values. We will continue our discussion later.

In denormalized form, we can represent 0. After setting the sign bit s to 1 and all other bits to 0, we get-0.0; Similarly, if all bits are set to 0, you get +0.0. Non-normalized numbers have other uses, such as representing decimals that are very close to 0, and these decimals are evenly close to 0, which is called "gradual underflow" attribute.

Here are two pieces of disassembly code to analyze how parameters are put on the stack:

printf("%f ",45);

00405028 mov esi,esp

0040502A Push 2Dh.

0040502 c push offset _ ORDER _ SERVER _ ADDRESS-0 ach(43 F2 ach)

0040503 1 call dword ptr [_ _ imp _ _ printf (43c124h)].

00405037 Add esp, 8

printf("%f ",d); (d is an integer variable)

00405028 mov esi,esp

0040502A mov ecx,dword ptr [d]

0040502D Push ecx

0040502 e push offset _ ORDER _ SERVER _ ADDRESS-0 ach(43 F2 ach)

00405033 call dword ptr [_ _ imp _ _ printf (43c124h)].

00405039 Add esp, 8

0040503C cmp esi,esp

0040503 e call _ RTC _ check esp(439760h)

Double a=5, c;

Floating b;

int d=0x40a00000,y = 6;

int * p;

char s = 5;

p = & ampd;

b =(float)a;

printf("%f,%f,%f,%f,%f,%f,%d ",b,c,(float)d,s,(float)s,y,y);

00405028 mov esi,esp

0040502A mov ecx,dword ptr [y]

0040502D Push ecx

0040502E mov edx,dword ptr [y]

0040503 1 push edx

00405032 movsx eax, byte pointer [s]

00405036 mov dword ptr [ebp-34h],eax

00405039 field dword ptr [ebp-34h]

0040503C submersible pump, 8

0040503F fstp qword ptr [esp]

00405042 movsx ecx, byte pointer [s]

00405046 Push ecx

00405047 field double-word pointer [d]

0040504A Sub-esp, 8

0040504D fstp qword ptr [esp]

00405050 Sub esp, 8

00405053 fld qword ptr [c]

00405056 fstp qword ptr [esp]

00405059 fld dword ptr [b]

0040505C submersible pump, 8

0040505F fstp qword ptr [esp]

00405062 push offset _ ORDER _ SERVER _ ADDRESS-0C4h(43 F2 ach)

00405067 call dword ptr [_ _ imp _ _ printf (43c124h)].

0040506D Add ESP for 30h.

00405070 cmp esi,esp

00405072 call _ RTC _ check esp(439780h)

What are the two single-precision floating points of real variables in C language?

Double precision type double

How many types of variables are there in C language? The basic types are:

Internationalorganizations (same as international organizations)

short

tea

flotage

double;twofold

long

Unsigned

needle

There are also combined data types, such as array, structure, union and so on. In addition, you can customize the data type.