4. Numbers and Math

Out of the box, COMMON LISP is exceptionally well suited to numerical mathematical calculations. Integers are not limited to a specific size (see Recipe 4-1). It comes with rational numbers so you can do arithmetic with unlimited precision (see Recipe 4-5). And it has complex numbers (see Recipe 4-8).

All of these numerical types are part of the standard and thus not only available in every COMMON LISP implementation but also fully integrated into the language. This chapter will look at them in detail—how they are used, how they can be printed and parsed, and what to look out for. It’ll also discuss arbitrary precision floats (see Recipe 4-7), which aren’t part of the standard but can be added with the help of a library. ...

Get Common Lisp Recipes: A Problem-Solution Approach 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.