[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird numeric predicates?



    Date: Tue, 21 Mar 89 03:20:09 PDT
    From: gyro@kestrel.arpa (Scott B. Layson)

       Date: Sun, 19 Mar 89 17:22 EST
       From: Alan Bawden <Alan@AI.AI.MIT.EDU>
       ....
       If instead comparison predicates coerce INEXACT->EXACT then consistently
       transitive answers will be obtained.

    I think that what this example really speaks to is the limitations of
    implicit arithmetic coercion.  It is really a form of DWIM.  (I am
    opposed to DWIM in any form -- some forms more than others.)

The first few times I read this paragraph I read it as accusing me of
advocating some form of DWIM.  I think I have now convinced myself that the
"it" in "It is really a form of DWIM" refers to the notion of coercing
between exact and inexact numbers in certain circumstances, and is not
directed at anything that I said.  Nevertheless, since the inflammatory
word "DWIM" has been used in close proximity to my message, I feel
compelled to restate the rather simple point that I was trying to make.

My entire point was that:

 Given that the current design for Scheme calls for the arithmetic
 primitives to accept exact or inexact arguments in any combination, then:
 
  1. If the comparison predicates compare exact numbers to inexact numbers
     by first coercing the exacts to inexacts, then the comparison
     predicates will not necessarily be transitive.  (Because
     EXACT->INEXACT is not an injection in the usual floating point
     implementation of inexact numbers.)
 
  2. If the comparison predicates compare exact numbers to inexact numbers
     by first coercing the inexacts to exacts, then the comparison
     predicates probably will be transitive.  (Because INEXACT->EXACT is an
     order preserving injection in the usual floating point implementation
     of inexact numbers.)

Now, if you would like to argue with the given that the arithmetic
primitives accept mixed exact and inexact arguments, we can do that.  You
might even find that you can convince me.  But I don't want anyone to lose
track of what I originally said because someone stigmatized it by using the
word "DWIM" in its presence.  I was not proposing anything that could be
described as DWIM, and in fact I was not proposing anything at all.  I was
pointing out the consequences of two different implementations of the
arithmetic comparison predicates.  Consequences, I might add, that most
implementors seem to be unaware of.