Chapter 16. Math
Math object, which contains math functions commonly encountered in application development (if you are doing sophisticated numeric analysis, you may have to find third-party libraries).
Outside of some basics, this chapter is not designed to teach you math; thatâs a book (or 2 or 10) of its own.
Throughout the code comments in this chapter, I will use a tilde (~) prefix to indicate that a given value is approximate. I will also refer to properties of the
Math object as functions, not methods. While they are technically static methods, the distinction is academic here, as the
Math object provides namespacing, not context.
A common need is to format numbers; that is, instead of displaying 2.0093, you want to display 2.1. Or instead of displaying 1949032, you want to ...
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.