[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
numerator/denominator
From: |
Kevin Ryde |
Subject: |
numerator/denominator |
Date: |
Tue, 19 Apr 2005 07:55:53 +1000 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Aubrey Jaffer noticed guile doesn't have r5rs numerator and
denominator and proposes the definitions below. The head has them
already with the exact fractions now, but I think I'll add these to
the 1.6 branch.
(define (numerator q)
(do ((num q (* 2 num)))
((integer? num) num)))
(define (denominator q)
(do ((num q (* 2 num))
(den (- q q -1) (* 2 den)))
((integer? num) den)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- numerator/denominator,
Kevin Ryde <=