[Top][All Lists]

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

frac -0x80..00 / 0x80..00

From: Kevin Ryde
Subject: frac -0x80..00 / 0x80..00
Date: Sat, 22 Nov 2003 07:00:29 +1000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

I think scm_make_ratio is missing one case of an integer result,
namely when the numerator is most-negative-fixnum and the denominator
is the negative of that (as a bignum).  Viz,

        (integer? (/ -536870912 536870912))
        => #f

where I would expect #t.  (Attempting to actually print that division
seems to go into an infinite recursion in number->string.)

        * numbers.c (scm_make_ratio): Check for numerator equal to
        SCM_MOST_NEGATIVE_FIXNUM and bignum denominator the negative of that,
        giving integer -1.

        * tests/fractions.test: Exercise most-negative-fixnum over -ve of

Attachment: numbers.c.make-frac.diff
Description: Text document

Attachment: fractions.test.most-neg.diff
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]