Ray Dillinger scripsit: > Okay, I got that far. But as I said, my problem is getting an exact > result while taking a qth root. That's the part I don't know how to > do, except by getting lucky in interval division.
Oh. Easy-peasy. Get a quick upper bound for the qth root, call it y, then do a binary search over the interval 1 .. y. You can memoize the fixnum-sized powers of q, too. The classic square-root-by-hand algorithm works like this too, except that it does a "decimal search" instead of binary search. It's a close relative of the long division algorithm. -- John Cowan http://ccil.org/~cowan [email protected] Mr. Henry James writes fiction as if it were a painful duty. --Oscar Wilde _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
