[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: weird math
- To: sr0o+@andrew.cmu.edu (Steven Ritter)
- Subject: Re: weird math
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Wed, 25 Aug 1993 18:21:29 -0600
- Cc: info-mcl
At 10:09 PM 8/25/93 +0000, Steven Ritter wrote:
>According to my reading of CLtL2 (292-293), this should not happen:
>? (= 1.4 (/ 7 5))
>NIL
>
>Especially since:
>? (= 1.4 (coerce (/ 7 5) 'float))
>T
>
>This isn't a general bug because:
>? (= 1.5 (/ 3 2))
>T
>
>This is the kind of bug that can shake your faith in the truth and
>purity of mathematics.
>
>I'm using MCL 2.0p2
MCL is correct. X3J13 changed the semantics of comparison operators.
In CLtL1, (= 1.4 (/ 7 5)) meant (= 1.4 (coerce (/ 7 5) float)).
In CLtL2, the comparison is exact.
1.4 cannot be exactly represented in IEEE format. The representation
produces a number that is slightly less than 7/5. On the other hand,
1.5 IS exactly representable in IEEE format.