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

*To*: mathematica@xxxxxxxxx*Subject*: Re: comparison operators and *typos*From*: Aubrey Jaffer <agj@xxxxxxxxxxxx>*Date*: Tue, 21 Jun 2005 12:44:30 -0400 (EDT)*Cc*: srfi-73@xxxxxxxxxxxxxxxxx*Delivered-to*: srfi-73@xxxxxxxxxxxxxxxxx*In-reply-to*: <20050620044846.C585D1334@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> (mathematica@xxxxxxxxx)*References*: <20050620044846.C585D1334@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

| Date: Mon, 20 Jun 2005 12:48:21 +0800 | From: "Chongkai Zhu" <mathematica@xxxxxxxxx> | | ======= At 2005-06-20, 10:06:21 Aubrey Jaffer wrote: ======= | >... | | (= -0 0) should be #f. Then (eqv? -0 0) ==> #f; which will break much existing Scheme code which tests for 0. The ZERO? procedure expects a number; one can test whether an arbitrary object is 0 with (eqv? obj 0). Because of -0, this test must be replaced by (and (number? obj) (<= -0 obj 0)). Another example where -0 breaks existing code is: (case val ((0) ...) ((1) ...) (else ...)) will not match when VAL is -0. (exact->string (my* -5 0)) ==> "-0". So -0 will occur often. | > | procedure: numerator q | > | procedure: denominator q | > | These procedures return the numerator or denominator of their | > | argument; the result is computed as if the argument was | > | represented as a fraction in lowest terms. The denominator is | > | always positive or zero. The denominator of 0 is defined to be | > | 1. (my-numerator |-0|) ==> 0 (my-denominator |-0|) ==> 1 (numerator 0) ==> 0 (denominator 0) ==> 1 If the NUMERATORs and DENOMINATORs of -0 and 0 are equal, then -0 and 0 must be the same number. But as you wrote, "(= -0 0) should be #f." If (< -0 0), then -0 must be negative; but: (my-negative? |-0|) ==> #f If (< -0 0), then (- 0 -0) must be nonzero; but (exact->string (my- 0 |-0|)) ==> "0"

**References**:**Re: comparison operators and *typos***From:*Chongkai Zhu

- Prev by Date:
**Re: comparison operators and *typos** - Next by Date:
**Revision of SRFI 73 available** - Previous by thread:
**Re: comparison operators and *typos** - Next by thread:
**Re: comparison operators and *typos** - Index(es):