Acronym for Multiple Precision Arithmetics. Library in pure Tcl available at : http://sarnold.free.fr/ ---- Released with a BSDish License. The fact is that the floating-point numbers are still experimental, even if it 'works'. (that means, the precision of fp. numbers is a subject i personnaly do not master) I guess it is not obvious to do such computations without losing precision at each step. What's new : in [tcllib] there is a bignum implementation that is much faster than mine. For your information it uses lists as an internal representation of bignums. ---- '''Examples''' with a 333MHz PII 100MHz PCI Bus PC with Windows Me. (mpa-v0.11) 50 % package require mpa 0.11 (mpa-v0.11) 51 % mpa::int::add 111111111111111111111 98237827463784678346478 98348938574895789457589 (mpa-v0.11) 52 % mpa::int::add 1000000000000000000000 99999999999999999 1000099999999999999999 (mpa-v0.11) 53 % mpa::int::mul 1001 9009 9018009 (mpa-v0.11) 54 % mpa::int::mul 10010001 9009009 90180189099009 (mpa-v0.11) 55 % mpa::float::pi 20 # Pi constant with 20 decimals, the result is cached in a namespace variable 3.14159265358979323846 (mpa-v0.11) 56 % time {mpa::float::pi 20};# result is cached in memory 363 microseconds per iteration (mpa-v0.11) 57 % time {mpa::float::pi 21};# result is now recomputed 90643 microseconds per iteration (mpa-v0.11) 58 % time {puts [mpa::float::pi 21]};# result is cached 3.141592653589793238462 4962 microseconds per iteration (mpa-v0.11) 59 % mpa::float::add 1.0 2.0 3.0~2 # the precision with 1.0 ans 2.0 is assumed to be 0.1 # and the precision of the sum is the sum of the precisions (mpa-v0.11) 60 % mpa::float::add 1.0000 2.0000 3.0000~2 (mpa-v0.11) 62 % mpa::float::format [mpa::float::mul 1.0000000 2.0000000]; # the precision of the product is approximatly A*Pb+B*Pa = 3e-7 2.000000 # now the number is formatted to be put on screen (mpa-v0.11) 63 % mpa::float::mul 1.0000000 2.0000000 2.0000000~4 # precision is computed to be always the smallest , # even if such computations are complex to handle and loss of CPU ----- This package is especially good when you want it to represent arbitrary floating-point numbers. See also : [bignum in pure tcl]. ----- [Category Mathematics] | [Category Acronym] | [Category Package]