section_path: Types/Real number arithmetic
section_name: Real number arithmetic
paragraph_text: Real number arithmetic
  
  Real number 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, like the root of 2 and π. Unlike rational number arithmetic, real number 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 2 + π {\displaystyle {\sqrt {2}}+\pi } or e ⋅ 3 {\displaystyle 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 leftmost digits are kept and remaining digits are discarded or replaced by zeros. For example, the number π has an infinite number of digits starting with 3.14159.... If this number is truncated to 4 decimal places, the result is 3.141. Rounding is a similar process in which the last preserved digit is increased by one if the next digit is 5 or greater but remains the same if the next digit is less than 5, so that the rounded number is the best approximation of a given precision for the original number. For instance, if the number π is rounded to 4 decimal places, the result is 3.142 because the following digit is a 5, so 3.142 is closer to π than 3.141. These methods allow computers to efficiently perform approximate calculations on real numbers.