User:Phlsph7/Real arithmetic

Real arithmetic
Real arithmetic is the branch of arithmetic that deals with the manipulation of both rational and irrational numbers. Irrational numbers are numbers that cannot be expressed through fractions or repeated decimals. Examples are the root of 2, $\pi$, and e (Euler's number). The set of real numbers is represented by the symbol $$\R$$. Unlike rational arithmetic, real arithmetic is closed under exponentiation as long as it uses a positive number as its base. The same is true for the logarithm of positive real numbers as long as the logarithm base is positive and not 1.

Irrational numbers involve an infinite non-repeating series of decimal digits. Because of this, there is often no simple and accurate way to express the results of arithmetic operations like $$\sqrt{2} + \pi$$ or $$e \cdot \sqrt{3}$$. In cases where absolute precision is not required, the problem of calculating arithmetic operations on real numbers is usually addressed by truncation or rounding. For truncation, a certain number of significant digits to the left are kept and additional digits to the right of the last significant digit are removed. For example, the number π has an infinite number of digits starting with 3.14159... . If this number is truncated to 4 significant digits, the result is 3.141. Rounding is a similar process in which the last significant digit is increased by one if the next digit is 5 or greater. If the next digit is less than 5, the last digit remains the same. For example, if the number π is rounded to 4 significant digits, the result is 3.142 because the following digit is a 5. These methods are essential to allow computers to efficiently perform calculations on real numbers.

Very large and very small real numbers are often expressed using normalized scientific notation. In it, numbers are represented using a so-called significand multiplied by a power of 10. The significand is a digit followed by a decimal point and a series of digits. For example, the normalized scientific notation of the number 8276000 is $$8.276 \times 10^6$$ and the number 0.00735 has the normalized scientific notation of $$7.35 \times 10^{-3}$$.

A common method employed by computers to approximate real arithmetic is called floating-point arithmetic. It represents real numbers similar to the scientific notation through three numbers: a significand, a base, and an exponent. The precision of the significand is limited by the number of bits allocated to represent it. If an arithmetic operation results in a number that requires more bits than are available, the computer rounds the result to the closest representable number. This leads to rounding errors. A consequence of this behavior is that certain laws of arithmetic are violated by floating-point arithmetic. For example, floating-point addition is not associative since the rounding errors introduced can depend on the order of the additions. This means that the result of $$(a + b) + c$$ is sometimes different from the result of $$a + (b + c)$$. The most common technical standard used for floating-point arithmetic is called IEEE 754. Among other things, it determines how numbers are represented, how arithmetic operations and rounding are performed, and how errors and exceptions are handled.