As pointed out, you want metaclass for this. A warning, I've overwritten many
of the dunders on classes for fun and I actually broke the ability to repr my
class in certain situations by overriding __eq__ and/or __hash__ something deep
in ipython/python with the repr. I forget the exact situatio
IEEE 754 is incredibly consistent with mathematics.
The easiest way to determine if a float operation would return inf, -inf, or
NaN is to quite literally make an expression and take the limit of it as a
certain variable approaches infinity.
0/0, inf/inf, 0*inf, inf-inf are standard Indeterm