[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ratio implementation
From: |
Bill Schottstaedt |
Subject: |
Re: ratio implementation |
Date: |
Mon, 13 Oct 2003 03:58:05 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 |
I made the requested changes (using the Oct-9 CVS Guile):
ftp://ccrma-ftp.stanford.edu/pub/Lisp/gratio-1.tar.gz
I haven't yet translated the test suite to Guile's form.
I notice that Guile doesn't support "exact complex", but
it appears that some other Schemes do -- is this a desired
extension?
guile> (exact? 2/3+i)
#f
Under scm_ash, the doc string:
"Formally, the function returns an integer equivalent to\n"
"@code{(inexact->exact (floor (* @var{n} (expt 2 @var{cnt}))))}.\n"
is incorrect:
guile> (ash .1 2)
0.4
but ash is not handling negative shifts correctly:
guile> (ash .1 -2)
Backtrace:
In standard input:
4: 0* [ash 0.1 -2]
standard input:4:1: In procedure quotient in expression (ash 0.1 -2):
standard input:4:1: Wrong type argument in position 1: 0.1
ABORT: (wrong-type-arg)
The scm_quotient function assumes its arguments are ints/bignums,
so it can't be used directly in ash.
Also: (sqrt 9/49) -> 3/7? Seems like it should parallel:
guile> (expt 2 -2)
1/4
- Re: ratio implementation, Marius Vollmer, 2003/10/07
- Re: ratio implementation, Marius Vollmer, 2003/10/07
- Re: ratio implementation,
Bill Schottstaedt <=
- Re: ratio implementation, Marius Vollmer, 2003/10/14
- Re: ratio implementation, Kevin Ryde, 2003/10/14
- Re: ratio implementation, Bill Schottstaedt, 2003/10/16
- Re: ratio implementation, Marius Vollmer, 2003/10/17
- Re: ratio implementation, Bill Schottstaedt, 2003/10/17
- Re: ratio implementation, Rob Browning, 2003/10/17
- Re: ratio implementation, Kevin Ryde, 2003/10/17