Some sample projects to illustrate the use of my LargeInt library
with VisualBasic. The last addition is an RPN big integer calculator,
doubling as library shell. These projects utilize the power
of the FreeBasic compiled bignumVB.dll
Version w/date 06-06-2009:
Sub 'Mult p, q, r' returns its result in r now,
leaving p unchanged. Added wrappers 'Lmul p, q' and 'Ldiv p, d'
to return results in left argument p.
Renamed function Decf(p) to Bufl(p) for (string)bufferlength,
sub 'CnvSt g, p' needs largeint p as second argument.
Sub Isqrt now uses the binomial (Ibn al-Banna) algorithm,
a third argument is added to return residue p - r^2.
Rewrote 'Ratdec g, p, q' as 'RatCnv g, p, q, b', where
b is added to expand p / q in any base from 2 through 17,
the string of base b-digits is in exponential format.
Sub 'Printr p, q, f, k, sw' has a CrLf-switch added.
Sub 'Readst p, g' also accepts hexadecimal string g now.
Added function LibErr to handle run-time error codes.
Fixed Logf(p) bug: used only 45 largeint bits.
Added Def###'s to PrintFun.bas, bignumVB.bi and bignumVB.bas,
so explicit Integer and Long argument types could be removed.
The largeint pseudopointer type is Integer now (previously Long).
Adapted CryptoVB, Picalc and RPNcalc accordingly; in the latter,
the functions {lcm}, {a/b}, {1/a}, {funit}, {bits} and {10^k} are
replaced with {quadr}, {conv}, {exp}, {log}, {p» r} and {r »p}.
{modsqr} accepts gcd(a,m) > 1.
To retain the modulus in the five modular functions,
it must be input as first argument now.
RPNcalc will convert an input decimal fraction to rational form,
if confirmed with [Enter].
Overflow is treated much gentler (no crude exits anymore),
leading to many minor improvements.
Added a little multiprecision benchmark and Miller-Rabin
wrapper to the 'minimal' map.
date 01-06-2009:
Rewrote the library in a simpler, more flexible form.
The size of the largeint number array is set at 95 Kb,
length and sign are both encoded in the initial word,
the sign of a negative number is now -32768, else zero.
Added integer functions Divint(p, a) and Odd(p),
stripped argument d from function Kronec(p, q, d),
also 5th argument h from sub 'Printr p, q, r, f, h',
renamed subroutine 'Copyf p, q' to 'Dup p, q', also the
Gete/ Sete pair to Getw/ Setw in both library and projects,
removed 'Dcr p, a', as 'Inc p, a' has signed argument a now,
sub 'Isqrt p, q' doubles root length each iteration step,
sub 'Bezout p, q, d' gives shorter return values,
and function Nxtprm(sw) is 3 times reentrant.
Plus some minor cleaning-up in RPNcalc.cls
Added library source code: a quite literal adaptation of the
QB version. This is not the source of bignumVB.dll, which is
distributed in "LargeInt.zip", .\library\freebasic\largeint.bas
date 01-15-2008:
In 'PrintFun.bas' subroutine Decf() is declared Long now,
added subroutine Work$, renamed Public string WrkD to Wdir.
date 05-05-2007:
Subroutine 'LargeInit(k As Long, f As String)' must now
be explicitly called with k = number of largeint's
in your program. f may be empty.
The size of the number array in the precompiled bignumVB.dll
is set at 144 Kb,
giving a maximal decimal number length of approximately
332784 \ (k + 5) digits.
Cleaned up the RPN calculator code using some new Sub's.
date 01-30-2007:
Changed the name of subroutine 'Init()' to 'LargeInit()'
Removed subroutines Andf, DecLSB, Pwr2, Pwr10
Added subroutines
Absf%, Bezout, Bitl%, Boolf, Gcd, Lcm, Logf#, Mp2%, Powr,
Triald, EnQ, ExQ%
Fixed a bug in function Kronec%
Rewrote the Crypto project to comply with
laboratory standards.
Added minimal bignumVB module sample Fibonacc.vbp
date 12-05-2005:
The library uses ByVal-, instead of ByRef-strings now,
so you'll have to recompile every existing VB largeint
module that calls the new bignumVB.dll library.
S.J.S.