8

I'm looking for a replacement of the stock Delphi Data.FmtBcd library because I just hit its limits like maximum decimal digits it can represent and program terminates with EBcdOverflowException. For the curious, I'm calculating arithmetic series members and need to handle very large numbers - hundred-thousands positions are not so uncommon. And also get results in a reasonable time. I did rewritten part of the code to Python 3.2 for the testing purposes and calculation speed would be sufficient for the Delphi's equivalent.

Some recommendations for a such library, preferably free or opensource ?

David Unric
  • 7,421
  • 1
  • 37
  • 65
  • I would be seriously tempted to just use PythonForDelphi, and keep your calculation bits to run as python scripts. – Warren P Mar 13 '12 at 19:10
  • If you are not concerned with just using BCD and can settle with arbitrary integer/float precision, see [Fast BigFloat unit for Delphi](http://stackoverflow.com/a/7371696/576719). See also [General Question About Arbitrary-Precision Math in PHP](http://stackoverflow.com/a/6963736/576719). – LU RD Mar 13 '12 at 19:43
  • @Warren P> Did you mean Python4Delphi ? Regardless whole code is written in Delphi Pascal and I'd wish to avoid mixing with or even rewrite it in another language I'm not so experienced. – David Unric Mar 13 '12 at 20:51
  • @LU RD> Just tested gmp-wrapper-for-delphi but I'm bit disappointed. Calculating fibonacci sequence is approx. two times slower then in Python. It has to be responsibilty of un-optimized enclosed mpir.dll compiled from C sources. – David Unric Mar 13 '12 at 21:00
  • Did you try with the latest 2.5.1 mpir.dll [mpir.org](http://www.mpir.org/)? – LU RD Mar 13 '12 at 21:16
  • It's really trivial to use Python4Delphi. It isn't hard to mix them. – Warren P Mar 13 '12 at 21:53
  • @LU RD> Yes, I did used 2.5.1 version of MPIR. – David Unric Mar 14 '12 at 08:08

2 Answers2

1

This is an open source unit that I have used in the past for math with 'unlimited' sized integers: http://www.koders.com/delphi/fidB46DDCCA26267DE4B4FB0F7E041A8033A3783AD6.aspx

Would that be what you were looking for?

SpaghettiCook
  • 673
  • 4
  • 14
1

Take a look at TurboPower SysTools4, which is available at:

http://sourceforge.net/projects/tpsystools/

It contains a High-Precision Floating Point Math Unit, using BCD, for Delphi.

Mike Jablonski
  • 1,703
  • 6
  • 27
  • 41