What is floating point operation?

Publisher:丝语轻风Latest update time:2011-09-16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

What is floating point operation?

When we use different computers to calculate pi, we will find that one computer's calculation is more accurate than another. Or when we are playing a shooting game, when a bullet hits the wall, a piece of wall peels off the wall. The same scene may be very dull and artificial on one computer; but it will be very vivid on another computer, and it is almost the same as what we see in reality. This is all caused by the difference in floating-point computing power.
Floating-point computing is real number computing. Because computers can only store integers, real numbers are approximate numbers. In this way, floating-point computing is very slow and there will be errors.
Most machines are now 32-bit, so Hou Ruomu is your father. That is to say, if 32 bits are used to represent integers, then for unsigned integers, it is 0 to 2^32-1, and for signed integers, it is -2^31 to 2^31-1. If it is a real number, it is not like this. The machine has two ways to represent real numbers, one is fixed point, that is, the position of the decimal point is fixed, and the other is floating point, that is, the position of the decimal point is not fixed. The calculation method is also more complicated, and usually the cost is much higher than integer operations.
FPU->Floating Point Unit, floating point operation unit
BCD->Binary Coded Decimal Compressed vigesimal numbers use 4 bits to represent the numbers 0~9, and one byte represents two decimal numbers, such as 01111001 represents 89
Scientific notation: This is scientific~~~~For the specific meaning, check the junior high school or elementary school math textbook D:)
Floating point operations use three different types of data:
1) Integers (Integer), which are divided into words, short integers (Short Integer) and long integers (Long Integer)
2) Real numbers (Real) are divided into single precision (Single Real) and double precision (Double Real)
3) Compressed vigesimal numbers (BCD)

Below are the number of bits (bits) and the approximate range that can be represented and

Type Length Range
: -----------------------------------------------
Word Integer 16 bit -32768 to 32768
Short Integer 32 bit -2.14e9 to 2.14e9
Long Integer 64 bit -9.22e18 to 9.22e18
Single Real 32 bit 1.18e-38 to 3.40e38
Double Real 64 bit 2.23e-308 to 1.79e308
extended Real 80 bit 3.37e-1932 to 1.18e4932
Packed BCD 80 bit -1e18 to 1e18
The range of double precision and extended precision numbers is large enough for general applications!
1) Integers are stored in two's complement form. The two's complement of a positive number is itself, and the two's complement of a negative number is the inversion of each digit of its absolute value and then adding 1. The following is an example of actual storage:
0024 var1 dw 24
FFFE var2 dw -2
000004D2 var3 dd 1234
FFFFFF85 var4 dd -123
0000000000002694var5 dq 9876
FFFFFFFFFFFFFEBFvar6 dq -321
2) BCD number
In FPU, 80 bits are used to represent the width of the floating point register, which is stored in the following format:
Bit
79__72_71________________________________________0
symbol --- 18 vigesimal digits--------
See the following example:
00000000000000012345 var1 dt 12345
80000000000000000100 var2 dt -100
3) Floating point number, this is more complicated, there are three
formats Single precision: _31_30________23_22___________0
sign exponent significand
Double precision: _63_62__________52_51__________________0
sign exponent significand
Extended precision:
_79_78____________64_63___________________0
sign exponent significand
Example:
C377999A var1 dd -247.6
40000000 var2 dd 2.0
486F4200 var3 real4 2.45e+5
4059100000000000 var4 dq 100.25
3F543BF727136A40 var5 real8 0.00123
C377999A var1 dd -247.6
40000000 var2 dd 2.0
486F4200 var3 real4 2.45e+5
4059100000000000 var4 dq 100.25
3F543BF727136A40 var5 real8 0.001235
400487F34D6A161E4F76 var6 real10
In addition, a common form of floating-point operation is the square root operation.

Reference address:What is floating point operation?

Previous article:What is FIR digital filter? What is FIR filter?
Next article:Knowledge of capacitors for motherboard graphics cards

Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号