Fixes bug 191116: rationalize broken

This commit is contained in:
Abdulaziz Ghuloum 2008-03-01 21:45:48 -05:00
parent 755843e251
commit db54cd0074
2 changed files with 4 additions and 4 deletions

View File

@ -2710,11 +2710,11 @@
(- (simplest^ (- n^) d^ (- n) d)))]
[else 1]))
(define (simplest^ n d n^ d^)
(let-values ([(q r) (quotient+remainder n d)])
(let-values ([(q r) (div-and-mod n d)])
(if (= r 0)
q
(let-values ([(q^ r^) (quotient+remainder n^ d^)])
(if (= q q^)
(let-values ([(q^ r^) (div-and-mod n^ d^)])
(if (= q q^)
(let ([v (simplest^ d^ r^ d r)])
(let ([n^^ (numerator v)] [d^^ (denominator v)])
(/ (+ (* q n^^) d^^) n^^)))

View File

@ -1 +1 @@
1406
1407