# TAOCP 1.2.2 Numbers, Powers, and Logarithms

> Study guide to TAOCP 1.2.2 Numbers, Powers, and Logarithms. A careful build-up of integers, rationals and reals, then powers with real exponents and…

Updated October 20, 2026.

## Summary {#summary}

TAOCP 1.2.2 Numbers, Powers, and Logarithms: A careful build-up of integers, rationals and reals, then powers with real exponents and logarithms in any base. Budget about 4 hours; do exercises 4, 11 and 17.

It ends with practical ways to compute logarithms by hand-style methods.

## Key facts {#key-facts}

- Week 31 of 145 on the cracked.guide path, in [TAOCP Vol 1: Fundamental Algorithms](https://cracked.guide/taocp/volume-1).
- Time budget: about 4 hours.
- 29 exercises in the section, rated 00 to M30; the guide picks 8.
- Picked exercises with Knuth's triangle for recommended: 4, 11, 17, 19, 22 and 27.
- Before you start: high-school algebra and exponent rules.

## Week 31 goals {#objectives}

By the end of week 31 you can:

- Compute logarithms in bases 2, e and 10, and convert between them.
- Explain how powers extend from integers to rational and real exponents.
- Use logarithms to count how many bits a number needs.

## This week's steps {#steps}

- Read §1.2.2 Numbers, Powers, and Logarithms: Skim the construction of the real numbers unless you enjoy it.
- Work the exercises (8 picked): Start with Ex 4, Ex 11, Ex 17; log what you solve below.
- Write down one thing you'd explain to someone: A few sentences in your own words in Your notes: the idea, why it works, an example. 30 words ticks this.

## Exercises {#exercises}

This section has 29 exercises, rated 00 to M30, and Knuth marks seven of them with the triangle for recommended. Most are quick. The interesting ones for a programmer are the log-sizing questions (19, 22) and the shift-and-add algorithms at the end (25, 28).

Worth your time:

- 4 (rated 05, recommended): Evaluate a fractional power by hand. Quick check on the exponent rules.
- 11 (rated 10, recommended): Work out how many digits of a logarithm you need for a given accuracy in the power. Error propagation in miniature.
- 17 (rated 05, recommended): A quick round of logs in various bases, a couple of which do not exist.
- 19 (rated 20, recommended): Decide whether a 14-digit decimal number fits in a 47-bit word. The log-to-count-bits skill you use when sizing integers.
- 22 (rated 20, recommended): Show a cheap approximation of the base-2 log from ln and log10, and bound its error.
- 25 (rated 22): Prove that a method using only shifts, additions and subtractions computes a binary logarithm. How machines did logs without multiplying.
- 27 (rated M25, recommended): Error analysis of the text's log10 method when each step is computed with limited precision.
- 28 (rated M30): Design and analyze a shift-and-add method for exponentials, the inverse of exercise 25. The stretch.

## Why it matters {#why}

Logs are everywhere in complexity analysis, bit counts and data sizes. Knowing exactly how log base changes work, and why lg n and ln n differ only by a constant, makes big-O arguments feel obvious instead of magical.

## Before you start {#before}

- High-school algebra
- Exponent rules

## How to approach it {#approach}

Skim the construction of the real numbers unless you enjoy it. Work through the logarithm identities with pencil and make a cheat sheet of lg, ln and log10 conversions. Try the method for computing a logarithm digit by digit on a small example.

## Common traps {#traps}

- Mixing up lg (base 2), ln (base e) and log10. Knuth uses lg for base 2 throughout the series.
- Spending the whole week on the real-number construction. It is background, not the point.

## Links {#links}

- [Knuth's TAOCP page (editions, errata, MIX/MMIX)](https://www-cs-faculty.stanford.edu/~knuth/taocp.html)
- [Vol 1 errata (plain text, from Knuth)](https://www-cs-faculty.stanford.edu/~knuth/err1.textxt)
- [Wikipedia: Logarithm](https://en.wikipedia.org/wiki/Logarithm)
- [Wikipedia: Binary logarithm](https://en.wikipedia.org/wiki/Binary_logarithm)

---

Source: https://cracked.guide/guide/knuth-w018-1
cracked.guide: A free, dated 145-week path to getting genuinely cracked at programming.
