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

Rustom Mody rustompmody at gmail.com
Mon Jul 18 06:14:56 EDT 2016


On Monday, July 18, 2016 at 2:59:56 PM UTC+5:30, Steven D'Aprano wrote:
> On Monday 18 July 2016 14:16, Rustom Mody wrote:

> > AIUI…
> > There are two almost completely unrelated notions of exact
> > 
> > 1. ⅓ in decimal cannot be exactly represented though 0.3 0.33 etc are
> > approximations.
> >    We could call these inexact forms of ⅓
> 
> But 0.3 is an exact representation of 3/10, 0.1 + 0.2, 0.6/2, etc.
> 
> 
> > 2. Measurement and observation produces numbers.  These are inexact
> > inherently.
> > 
> > Scheme's notion of exact is towards capturing the second notion.
> 
> I don't see anything in the Guile documentation you linked to which supports 
> that interpretation.

Exact example :: index operations into data structures may need to know the index exactly, as may some operations on polynomial coefficients in a symbolic algebra system.
Inexact example :: the results of measurements are inherently inexact, and irrational numbers may be approximated by rational and therefore inexact approximations.

[from the Scheme standard http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-6.html ]

I believe the two clauses:
- measurements inherently inexact
- rational approximations to irrationals

The first represents the basic intention
The second represents the fact that pragmatically we are stuck with things like
floating point as the same chapter indicates at start:


|| This chapter describes Scheme's model for numbers. It is important to
|| distinguish between the mathematical numbers, the Scheme objects that
|| attempt to model them, the machine representations used to implement
|| the numbers, and notations used to write numbers. In this report, the
|| term number refers to a mathematical number, and the term number
|| object refers to a Scheme object representing a number. This report
|| uses the types complex, real, rational, and integer to refer to both
|| mathematical numbers and number objects. The fixnum and flonum types
|| refer to special subsets of the number objects, as determined by
|| common machine representations, as explained below.
||  
||  Numbers may be arranged into a tower of subsets in which each level is a subset of the level above it:
||  
|| number
||     complex
||     real
||     rational
||     integer
||  
|| For example, 5 is an integer. Therefore 5 is also a rational, a real,
|| and a complex. The same is true of the number objects that model 5.
||  
|| There is no simple relationship between the subset that contains a
|| number and its representation inside a computer. For example, the
|| integer 5 may have several represen || operations treat number objects as abstract data, as independent of
|| their representation as possible. Although an implementation of Scheme
|| may use many different representations for numbers, this should not be
|| apparent to a casual programmer writing simple programs.

Whether scheme achieves all these laudable and lofty goals of
representation independence, genuine mathematical subsetting (unlike
the usual programming story where float and int are disjoint) etc,
I will along with Marko say: “Cant say if it has turned out practicable”

Practicability has of course many variables
floating point h/w induces floating point languages perpetuates the h/w
perpetuates the languages… etc

Are viable alternatives possible?? Dunno…



More information about the Python-list mailing list