Defining FixedPoint binary arithmetic operators

The sole reason for defining a new class of numbers is to overload the arithmetic operators. Each FixedPoint object has two parts: value and scale. We can say some value, , is a fraction of the value  divided by the scaling factor : .

Note that we've worked out the algebra in the following example using ...

Get Mastering Object-Oriented Python - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.