At Wed, 10 Aug 2005 23:05:06 +0200, Thomas Chust wrote: > > #;2> (expt 10 100) > 10000000000000110891155767964156222877689497504522960006971153529700550125477736178357726682741211136
The docs already note that expt gives incorrect results for exact numbers. In the meantime you can use something like this: (define (power base e) ; like expt but e must be an integer (define (square x) (* x x)) (if (negative? e) (/ 1 (power base (- e))) (let lp ((res 1) (e e)) (cond ((zero? e) res) ((even? e) (* res (square (lp 1 (quotient e 2))))) (else (lp (* res base) (- e 1))))))) #;5> (power 10 100) 1000000000000000000000000000000000000000000000000000000000000000000000000000000\0000000000000000000000 -- Alex _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users