Floating point operation is real operation, because the computer can only store integers, so real numbers are divisors, so floating point operation is very slow and there will be errors. Most machines are 32-bit, that is to say, 32 bits are used to represent integers. For an unsigned integer, it is 0 to 2 ^ 32-1. For a signed integer, it is - 2 ^ 31 to 2 ^ 31-1.<br>Floating point arithmetic is the structure of floating-point arithmetic. At present, it is realized by circuit and applied in computer chip. It is a great development after the integer arithmetic because before the invention of the floating-point arithmetic, the floating-point arithmetic in the computer was simulated by integer arithmetic, which is very inefficient.<br>1. Operation steps of floating-point addition and subtraction<br>Set two floating-point numbers x = MX ※ 2ex y = my ※ 2ey<br>To achieve x ± y, the following five steps are required:<br>① Opposite order operation: small order to large order<br>② Add and subtract mantissa<br>③ Normalization processing: the result of mantissa operation must be a normalized floating-point number. For the complement mantissa of double sign bits, it must be 001 ×× XX or 110 XX If the form of ×× does not conform to the above form, it shall be handled with left or right gauge.<br>④ Rounding operation: in order to ensure accuracy, the rounding method of "0" to "1" is often used to round the mantissa value moved out to the right.<br>⑤ Correctness of judgment result: that is, check whether the order code overflows<br>If the order code underflow (shift code means 00 0), set the result to machine 0;<br>If the order code overflows (exceeding the maximum value represented by the order code), set the overflow flag.<br>2. Operation step 0 of floating point multiplication and division<br>① Order code operation: order code sum (multiplication) or order code difference (Division)<br>That is, [ex + ey] shift = [ex] Shift + [ey] supplement<br>[ex ey] shift = [ex] Shift + [- ey] supplement<br>② Mantissa processing of floating-point numbers: the result of mantissa multiplication and division in floating-point numbers should be rounded.<br>
正在翻译中..