chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Problems with rationals


From: John Cowan
Subject: Re: [Chicken-users] Problems with rationals
Date: Mon, 9 Apr 2012 16:20:40 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Peter Bex scripsit:

> > Is this a bug in chicken?
> >     (rational? 6/10) => #f
> 
> Chicken by itself doesn't support ratnums.  You'll need the
> "numbers" egg to get the full numeric tower (including arbitrarily
> large numbers and complex numbers).

True enough, but rational? returns true on every rational number, not
just ratnums.  Consequently, in core Chicken it should return #f on
non-numbers, +inf.0, -inf.0, and +nan.0, and #t on all other numbers.
And on 4.7.5 that's just what it does.  Unfortunately, the OP doesn't
say which version they're using.

You do get a warning about coercion to flonum from (rational? 6/10),
but you also get the right answer, namely #t.

> > Also
> >     (* 1.0 5/2)
> > produces
> > Error: (*) bad argument type: 5/2
> 
> If I want to reproduce this, do I need to type in anything else?
> It doesn't happen here.

Nor for me either.

BTW, I think you should go ahead and release the trunk numbers egg.
It surely has fewer bugs than the current release, even if it's not
Practically Perfect In Every Way.

-- 
John Cowan   address@hidden   http://ccil.org/~cowan
I must confess that I have very little notion of what [s. 4 of the British
Trade Marks Act, 1938] is intended to convey, and particularly the sentence
of 253 words, as I make them, which constitutes sub-section 1.  I doubt if
the entire statute book could be successfully searched for a sentence of
equal length which is of more fuliginous obscurity. --MacKinnon LJ, 1940



reply via email to

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