Re: Big Number Arithmetic

From: Tom St Denis (tom_at_securescience.net)
Date: 04/12/04


Date: Mon, 12 Apr 2004 15:44:48 GMT

Gary Shannon wrote:

>
> "SKH" <skh@yoyodyne.net> wrote in message
> news:pan.2004.04.12.14.15.53.306599@yoyodyne.net...
>> On Sat, 10 Apr 2004 20:50:52 +0000, Gary Shannon wrote:
>>
>> > The quickest to implement solution is UBASIC
>> > http://archives.math.utk.edu/software/msdos/number.theory/ubasic/.html
>> >
>> > It's a version of BASIC with 2600 digits of precision on integers and
>> > floats. It also has lots of cool built-in functions and a complete
>> > help
>> > system. Pretty cool of a freeware program. I've used it for years for
>> > playing around with large primes.
>>
>> I can't help but wondering why does UBASIC keep being mentioned at all in
>> the context of arbitrary precision arithmetic? The program is ancient,
>> not available in source code, tied to a single platform, and not all that
>> poweful (among other things, 2,600 digits is kind of puny) when compared
>> with the many, far more sophisticated tools currently available in source
>> code: GMP, calc, Simath, GAP, Pari, Maxima, etc.
>>
>> For what the original poster seems to have in mind, Simath, GAP and Pari
>> are the best choices.
>
> Simply because I keep UBASIC around for when I need a quick and dirty
> calculation to a few hundred digits. In thirty seconds flat I can load
> UBASIC, type my problem and have the answer. Give me 45 seconds and I can
> write a dozen lines of code to provide answers to more complex problems.
>
> The reason is simply that it is very quick and easy to use. I'll often
> prototype an algoprithm in it before writing it for real in C++ just
> becuase
> it's so quick to use. When it takes me 30 esconds to get and answer why
> would I want to mess with a "more sophisticated tool" "in source code". I
> want to know what 11213^97 mod 10000 is right now, I don't want to fool
> with source code for half an hour to set the problem up.

Ahem....

----
bash-2.05b# time bash
bash-2.05b# bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
2^100 % 1000
376
quit
bash-2.05b# exit
exit
real    0m8.109s
user    0m0.010s
sys     0m0.000s
----
I win I win!
> As for being ancient, I have a hammer in the garage that's over a hundred
> years old and it still pounds nails just fine.  There are times when "good
> enough" is good enough.
Admitedly I've never used UBASIC and if it works for you that's good.  The
point is though that not everyone uses MS-DOS still.  Tools like bc [which
personally I find rather murky] and gp-pari, octave, etc... are free and
more modern.  For example....
---
bash-2.05b# time bash
bash-2.05b# gp
                  GP/PARI CALCULATOR Version 2.1.5 (released)
                i686 running linux (ix86 kernel) 32-bit version
                (readline v4.3 enabled, extended help available)
                       Copyright (C) 2002 The PARI Group
PARI/GP is free software, covered by the GNU General Public License, and
comes WITHOUT ANY WARRANTY WHATSOEVER.
Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.
   realprecision = 28 significant digits
   seriesprecision = 16 significant terms
   format = g0.28
parisize = 4000000, primelimit = 500000
? x = 2^100000 % 100
%1 = 76
? quit
Good bye!
bash-2.05b# exit
exit
real    0m10.152s
user    0m0.020s
sys     0m0.000s
---
So while things like OpenSSL BN, GMP and LibTomMath exist for people wanting
to write programs with MP numbers you need not them to work with them.  
Tom


Relevant Pages