Question

Can I work with large numbers (more than 10^400) with built-in method in Delphi?

Was it helpful?

Solution

Not built-in, but you might want to check out MPArith for arbitrary precision maths.

OTHER TIPS

There is also a Delphi BigInt library on SourceForge . I haven't tried it however, but include for completeness.

You could implement your own large number routines using Delphi's operator overloading.

For example add, subtract, multiply and division.

Intel has also added new instructions for multiply and possibly also for division in their latest chip design to come out in the near future.

One of these instructions is called: mulx

Intel mentions multiple carry streams which would allow multiplication to be accelerated as well.

x86 already had subtract with borrow, and add with carry, so now these new instructions do more or less the same for long multiplication and division and such... there are two methods to do multiplication and by using both apperently this becomes possible.

In the future Delphi will probably support these new instructions as well which could make programming something like this extra interesting.

For now these 4 basic operations might take you somewhere... or perhaps nowhere.

It depends a bit on what you want to do.. what kind of math ? just basic math like add/sub/mul/div

Or more complex math like cosinus, sinus, tan, and all kinds of other math functionality.

As far as I know operator overloading is available for records... I can vaguely remember that it might have been added to classes as well but take a grain of salt with that for now.

Operator overloading used to have a bug when converting between types... but it's been solved in later delphi versions, so it should be good to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top