5.3. Functions

Before pocket calculators became cheap and powerful, we used lookup tables in books. Go to a used bookstore, pick up an old finance, trig, or statistics book, and look in the back. There will be tables of functions for net present value, sine and cosine, and assorted statistical tests. The most famous book was CRC Standard Mathematical Tables and Formulae for tables. The 31st edition was published in 1995, which gives you an idea how long it has been around. You can now get it on a CD.

The obvious question is why I would want to implement a function as a lookup table when I have fast, cheap computing power. One good reason is that if you only use a few thousand values of the function, they will fit into main storage, where they ...

Get Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.