ArticleslgStudy

computer science

Floating-point arithmetic

Floating-point arithmetic is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Floating-point arithmetic rather than just read about it. In short: In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a significand (a signed sequence of a fixed number of digits in some base) multiplied by an integer power of that base. Numbers of this form are called floating-point numbers.

Floating-point arithmetic — main illustration
Floating-point arithmetic — illustration

Key takeaways

  • Floating-point arithmetic belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Floating-point arithmetic to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Floating-point arithmetic from memory before moving on to harder problems.

Reference excerpt

In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a significand (a signed sequence of a fixed number of digits in some base) multiplied by an integer power of that base. Numbers of this form are called floating-point numbers. For example, the number 2469/200 is a floating-point number in base 10 with five digits: 2469/200=12.345=12345⏟significand×10⏟base−3⏞exponent However, 7716/625 = 12.3456 is not a floating-point number in base 10 with five digits—it needs six digits. The nearest floating-point number with only five digits is 12.346. And 1/3 = 0.3333... is not a floating-point number in base ten with any finite number of digits. In practice, most floating-point systems use base two, though base ten (decimal floating point) is also common. Floating-point arithmetic operations, such as addition and division, approximate the corresponding real number arithmetic operations by rounding any result that is not a floating-point number itself to a nearby floating-point number. For example, in a floating-point arithmetic with five base-ten digits, the sum 12.345 + 1.0001 = 13.3451 might be rounded to 13.345. The term floating point refers to the fact that the number's radix point can "float" anywhere to the left, right, or between the significant digits of the number. This position is indicated by the exponent, so floating point can be considered a form of scientific notation. A floating-point system can be used to represent, with a fixed number of digits, numbers of very different orders of magnitude – such as the number of meters between galaxies or between protons in an atom. For this reason, floating-point arithmetic is often used to allow very small and very large real numbers that require fast processing times. The result of this dynamic range is that the numbers that can be represented are not uniformly spaced; the difference between two consecutive representable numbers varies with their exponent.

Over the years, a variety of floating-point representations have been used in computers. In 1985, the IEEE 754 Standard for Floating-Point Arithmetic was established, and since the 1990s, the most commonly encountered representations are those defined by the IEEE. The speed of floating-point operations, commonly measured in terms of FLOPS, is an important characteristic of a computer system, especially for applications that involve intensive mathematical calculations. Floating-point numbers can be computed using software implementations (softfloat) or hardware implementations (hardfloat). floating-point units (FPUs, colloquially math coprocessors) are specially designed to carry out operations on floating-point numbers and are part of most computer systems. When FPUs are not available, software implementations can be used instead.

Overview

Floating-point numbers A number representation specifies some way of encoding a number, usually as a string of digits. There are several mechanisms by which strings of digits can represent numbers. In standard mathematical notation, the digit string can be of any length, and the location of the radix point is indicated by placing an explicit "point" character (dot or comma) there. If the radix point is not specified, then the string implicitly represents an integer and the unstated radix point would be off the right-hand end of the string, next to the least significant digit. In fixed-point systems, a position in the string is specified for the radix point. So a fixed-point scheme might use a string of 8 decimal digits with the decimal point in the middle, whereby "00012345" would represent 0001.2345. In scientific notation, the given number is scaled by a power of 10, so that it lies within a specific range—typically between 1 and 10, with the radix point appearing immediately after the first digit. As a power of ten, the scaling factor is then indicated separately at the end of the number. For example, the orbital period of Jupiter's moon Io is 152,853.5047 seconds, a value that would be represented in standard-form scientific notation as 1.528535047×105 seconds. Floating-point representation is similar in concept to scientific notation. Logically, a floating-point number consists of:

… excerpt ends here. Continue reading the full article.

Illustrations

Floating-point arithmetic: An early electromechanical programmable computer, the Z3, included floating-point arithmetic (replica on display at Deutsches Museum in Munich)
An early electromechanical programmable computer, the Z3, included floating-point arithmetic (replica on display at Deutsches Museum in Munich)
Floating-point arithmetic: Single-precision floating-point numbers on a number line: the green lines mark representable values
Single-precision floating-point numbers on a number line: the green lines mark representable values
Floating-point arithmetic: Leonardo Torres Quevedo, in 1914, published an analysis of floating point based on the analytical engine
Leonardo Torres Quevedo, in 1914, published an analysis of floating point based on the analytical engine
Floating-point arithmetic: Konrad Zuse, architect of the Z3 computer, which uses a 22-bit binary floating-point representation
Konrad Zuse, architect of the Z3 computer, which uses a 22-bit binary floating-point representation
Floating-point arithmetic: William Kahan, principal architect of the IEEE 754 floating-point standard
William Kahan, principal architect of the IEEE 754 floating-point standard

Worked examples

Example 1 — a first encounter with Floating-point arithmetic

Start with the simplest possible case. Write down what Floating-point arithmetic claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Floating-point arithmetic before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Floating-point arithmetic ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Floating-point arithmetic

In research
Floating-point arithmetic appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Floating-point arithmetic in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Floating-point arithmetic is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer arithmetic, Floating point, so understanding it makes those chapters shorter.
In everyday life
Look for Floating-point arithmetic outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Floating-point arithmetic” →

How to study Floating-point arithmetic in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Floating-point arithmetic means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Floating-point arithmetic out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Floating-point arithmetic in simple terms?

In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a significand (a signed sequence of a fixed number of digits in some base) multiplied by an integer power of that base. Numbers of this form are called floating-point numbers.

Why does Floating-point arithmetic matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Floating-point arithmetic?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Floating-point arithmetic.

Tags

  • Computer arithmetic
  • Floating point

Keep exploring