On Tue 22 Feb 2011 18:54, Mark H Weaver <m...@netris.org> writes: > Andy Wingo <wi...@pobox.com> writes: > >> On Tue 15 Feb 2011 10:49, Mark H Weaver <m...@netris.org> writes: >>> The first patch is trivial, but there for the sake of correctness. >> >> Please apply, thanks. > > Ludo applied this before the 2.0.0 release.
Ah, cool. > (define (round-ash n count) > (let ((r (ash n count))) > (if (and (negative? count) > (bit-set? (- -1 count) n) > (or (odd? r) (< (first-set-bit n) (- -1 count)))) > (1+ r) > r))) Thanks for all the explanation. You might get good results with (logand n (ash 1 X)), given that both logand and ash have opcodes. Dunno. > Having said all this, let's hold off on this patch for now. I'm > modifying my bigfloat module to do strictly correct rounding, and that > may require something slightly more powerful than ash and round-ash. In > particular, I it may be necessary to have variants that return the > remainder as well as the quotient, or maybe just some partial > information about the remainder. OK, will hold off then. Happy hacking! Andy -- http://wingolog.org/