Re: rational arithmetic library?

taltman_at_noshpam.lbl.government
Date: 02/24/04


Date: Tue, 24 Feb 2004 12:49:46 -0800

Rahul Jain <rjain@nyct.net> writes:

> taltman@noshpam.lbl.government writes:
>
>> 1) The fun of implementing rational arithmetic in Scheme from scratch
>> aside, is there a library already implemented?
>
> Most implementations of Scheme already have rationals. From what I
> gather, scheme doesn't require rationals, but requires certain
> relationships with other numerical types to hold, if those other types
> are implemented.

I took a second look at R5RS, and I realized my confusion; I guess my
current implementation-of-choice, Guile, doesn't support 'numerator',
'denominator', or 'rationalize'! So I tried some others:

*DrScheme: yes
*Guile: no
*Chicken: no
*Bigloo: yes
*Scheme48/Scsh: yes
*SCM: no

Is there any more definitive information about this kind of "optional
standard" across various Scheme implementations? Specifically, are
there implementations which internally represent the division of
integers as the creation of a rational number, with both the numerator
and the denominator being bignums? If there's a limit to an
implementation's ability to store rationals (due to the numerator
and/or the denominator being fixnums), then they're useless for the
scientific application I had in mind.

So I guess this is standard in CL. Does the HyperSpec mandate this?
And are both the numerator and the denominator required to be
represented as bignums? I read the HyperSpec, and it didn't seem to
mention either way...

Would I be better off just using a CAS like GNU Maxima?

~Tomer



Relevant Pages

  • Re: rational arithmetic library?
    ... >>Most implementations of Scheme already have rationals. ... >>relationships with other numerical types to hold, ...
    (comp.lang.lisp)
  • Re: R6 Counterproposal
    ... the features in interpreters that support them and ... can decide, in their own implementations, to provide ... Nothing stops anyone from doing that today, with almost any Scheme system. ... Some languages and implementations have done something along those lines, and had some success with it. ...
    (comp.lang.scheme)
  • Re: Dissecting the electorate
    ... Real Work) want vendors to produce new implementations that run faster, ... To the best of my knowledge there is only one vendor of Scheme ... standardization (of a big language). ...
    (comp.lang.scheme)
  • Re: Square brackets?
    ... existing Scheme implementations it would be a mess. ... If it is *not* standard, ... collaborative project would by nature stick to the portable syntax. ...
    (comp.lang.scheme)
  • Re: So confused with scheme options
    ... Maybe Scheme is a community, but a dysfunctional one at best. ... Both CL and Haskell have numerous implementations (though ... deviate from the spec. ...
    (comp.lang.scheme)