On Sun, Dec 29, 2019 at 07:43:28PM -0500, David Mertz wrote: > the notional approximations that bit-patterns give of Rational numbers (not > sure why Richard keeps insisting it's about Reals, not Rationals... albeit > there is no difference that means anything to this discussion).
Excluding NANs and INFs, every float is a rational number, but that's forced on us by the implementation. The intention is for floats to model (even if imperfectly) the Reals ℝ, not the Rationals ℚ. If floats were intended to model the Rationals, trig functions would be useless, since almost no sines or cosines are rational numbers. https://en.wikipedia.org/wiki/Niven's_theorem Likewise the sqrt() function, and most powers, logs and exp() functions would also be useless. Very, very few logarithms, roots and exponents would return Rationals. This is why there are no Fraction.sin, Fraction.log, Fraction.sqrt etc methods, but if there were, they would have to return a float or a decimal or other equivalent non-Rational number. The bottom line is: floats model Reals, not Rationals. -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/TO23YHCYBK55UFKCYSESRWYCHPIIUGIJ/ Code of Conduct: http://python.org/psf/codeofconduct/