Re: Rounding Revisited Message #4 Posted by Rodger Rosenbaum on 21 July 2009, 11:57 p.m., in response to message #3 by Werner
Here's one I came up with that works (I think) on all positive integers, including near the EOPR (defined above):
35.0 bytes
Round to odd integer
<< DUP 2 MOD 3 2 / == - 0 RND >>
It doesn't work for negative integers.
It seems to me that you can find very short routines that work for all positive and negative numbers, but that fail near the EOPR. Or, you can find short routines that work for only positive (or negative) numbers, and don't fail near the EOPR. But you can't (so far) find short routines that work for both positive and negative numbers, and don't fail near the EOPR.
|