On 2/14/11 3:44 PM, Stephen Bloch wrote:

On Feb 14, 2011, at 3:26 PM, David Van Horn wrote:

On 2/14/11 3:14 PM, Sam Tobin-Hochstadt wrote:
No, it's not a bug.  Since 1e100 is an inexact number, there's
uncertainty about the minimum of those two numbers, and the result is
therefore inexact.

I would've expected min to return a number that is `eq?' to one of its 
arguments.

In other words, what is wrong with this definition of `min'?

(define (min n1 n2)
  (cond [(<= n1 n2) n1]
        [else n2]))

What's wrong with this is that, mathematically, since 1e100 is inexact, we're not CERTAIN it's>= 0, so 
the "proper" answer to (<= n1 n2) is not true but rather almost-certainly-true.  (An 
"inexact Boolean", if you will....)

When you define the function as above, the "<=" takes its best guess as to 
which number is really smaller and pretends that the answer is certain.

Then what is the correct definition?

David
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Reply via email to