Chapter 11. Number Systems
God created the integers, all else is the work of man.
This chapter is a loose collection of tidbits with a common theme: problem solving techniques that involve quantities beyond the simple integers and floating-point numbers of regular Perl scalars. We begin with a more thorough treatment of these quantities: how you can use Perl to fix constants, cope with a computer’s imprecision, and manipulate very large numbers, very small numbers, and fractions.
Next, we’ll cover methods for computing with strange systems of numbers: bits and bases, bit vectors, complex numbers, different coordinate systems, dates and times, and Roman numerals.
Finally, we’ll delve into trigonometry and significant series: arithmetic, geometric, and harmonic progressions, the Fibonacci sequence, Bernoulli numbers, and the Riemann zeta function.
Integers and Reals
The set of natural numbers—one, two, three, and so on—was
all our ancestors needed when counting fellow cavemen and
not-so-fellow mammoths. Eventually, zero and negative numbers came
about, and then rational numbers (fractions). Then mathematicians
realized the difference between rational numbers and irrational
numbers (like
and
), and pretty much ruined math for people who like counting on ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access