[fpc-devel] divide bcd's

Joost van der Sluis joost at cnoc.nl
Tue Jun 14 09:28:40 CEST 2011

Hi all,

Dividing BCD's doesn't go wel:


It's all in this function in the FmtBCD unit:

procedure BCDDivide ( const Dividend,
                              Divisor : tBCD;
                          var BCDout : tBCD );

I've tried to understand how the code works. I think it tries to
implement the algorithm as described here: 

But I can't follow. Florian checked in the original code. Did he wrote
it himself? It could be that there's just a small problem with an index
or something. But I can't find it. Maybe someone else can.

If not, I think we should rewrite the whole function.

My Lazarus blog: http://www.lazarussupport.com/lazarus/weblog

More information about the fpc-devel mailing list