Stavros Macrakis wrote:
> On Wed, Oct 8, 2008 at 9:25 AM, Raymond Toy <raymond.toy at ericsson.com
> <mailto:raymond.toy at ericsson.com>> wrote:
>
> > ... Also, should we round the printed result?
> >
> > fpprec:16;
> > fpprintprec:4;
> > 1.56789b0 -> 1.567b0
> >
> > Yes, the correct result here would be 1.568b0.
>
> Hmm. That's not so easy with the current algorithm because the number
> has already been converted to a list of individual digits. Doing the
> example above is easy, but not so easy for something like 1.999999b0.
>
>
> It is important to round correctly. I am surprised that the current
> algorithm first generates the digits and then rounds/truncates. That is
> not a good way to do it....
If I feel motivated some day, I might steal CMUCL's float printer. It's
pretty portable, should work with bigfloat's, and it's reasonably fast.
It's an implementation of Burger and Dybvig's float printer algorithm.
CMUCl's implementation is rather complicated. The original algorithm
isn't as complex. That might suit us just fine....
Ray