What exactly is "exact" (was Clean Singleton Docstrings)

Marko Rauhamaa marko at pacujo.net
Mon Jul 18 02:21:30 EDT 2016


Chris Angelico <rosuav at gmail.com>:

> Ah. Okay. So in theory, you could have exact float literals and
> inexact integer literals, if you tag them in some way:
>
> 300   ; Exactly 300
> 300!  ; Inexact - roughly 300
> 3.0  ; Exactly three
> 3.0!  ; Roughly three and zero tenths

In Scheme:

   #e300
   #i300
   #e3.0
   #i3.0

In principle, a Scheme implementation could have exact algebraic numbers
spiked with exact constants like e and π. In practice, exact numbers are
integers and rationals, while inexact numbers are floats and complex
numbers. It is a matter of opinion whether the conceptual abstraction is
worth the confusion.


Marko



More information about the Python-list mailing list