Flying Sheep Inc. is proud to present the BigNumber library.
The library provides a class TNumber that can handle Natural numbers of up to 2147483648 digits long (provided you have the memory to store the result in memory)
This allows for a range larger than the Float type, and without loss of precision.
Ever needed (or wanted) to calculate 9^99 with absolute precision?
Answer:
29512665430652752148753480226197736314359272517043832886063884637676943433478020332709411004889)
or Fac(100)?
Answer:
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
In that case:
this is the library to use.
The library also provides conversion functions from and to Hexadecimal and Binary.
Checkout the code (including all dependencies) from my svn repository:
svn co http://svn.code.sf.net/p/flyingsheep/code/trunk/wtf /some/path/on/your/computer
Or browse the svn repository at:
http://sourceforge.net/p/flyingsheep/code/HEAD/tree/trunk/wtf/Features:
- TNumber supports almost infinite big numbers with absolute precision calulation
- TNumber supports threadsafe caching of operations, with options to lock and unlock the cache
- Caching can be local to the instance or shared with other instances
- Caching can be turned on and off on the fly (default at creation is caching: on)
- TNumber supports object oriented boolean type handling (see the BoolFactory unit for details)
- TNumber accepts decimal, hexadecimal and binary input to set it's value
- TNumber provides a callback event for very long calculations, thus providing the means to update the GUI
- In the true spirit of FreePascal, this library is fully OS and Platform independant
- Unfortunately the library does not (and will not either in future) work perfectly in programs that use TP mode {$mode tp}
BigNumbers needs the following units (all provided at the svn repository as mentioned above):
- NCalc
- Expressions
- BoolFactory
- NumberOperationsCache
Bugs or enhancements can be reported here on the forum.
When the time is ripe, this library may ver well become part of the FCL.
Bart