Re: Big integer arithmetic
From: Edward G. Nilges (spinoza1111_at_yahoo.com)
Date: 06/22/04
- Next message: Randy Howard: "Re: what does "serialization" mean?"
- Previous message: Phlip: "Re: how can i evaluate...?"
- In reply to: Richard Cavell: "Big integer arithmetic"
- Next in thread: Bill Unruh: "Re: Big integer arithmetic"
- Reply: Bill Unruh: "Re: Big integer arithmetic"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 21 Jun 2004 19:54:48 -0700
Richard Cavell <richardcavell@mail.com> wrote in message news:<40d6cada$0$9457$5a62ac22@per-qv1-newsreader-01.iinet.net.au>...
> Hi,
>
> I want to use some big integers (like 2 to the power 1024) to do some
> arithmetic using really large primes. I have Windows/Visual C++, Mac
> OSX/gnu/XCode and Linux at my disposal.
I have written a big integer object in Visual Basic 6 which may not be
as efficient as you like, but which was heavily tested and has a nice
user interface: cf. www.pinpub.com, cf. Hardcore Visual Basic 8-2003.
It was written in honor of John Nash (a beautiful mind) who I assisted
rather briefly with his own big integer solution several years ago.
However, in this connection, note that Nash seems to have switched to
using Mathematica. You might want to consider using Mathematica if
possible for this reason.
>
> Now, this is how I see the options:
>
> 1. Create my own big integer class - I can do it, but it re-invents the
> wheel, runs the risk that I will make errors that I'll not find, and
> also runs the risk that I simply won't do it as well as those already
> invented.
>
But, such a solution may be optimal for your unique needs. Too much
software is acquired as if it were a baseball cap using the Rust Belt
metaphor that software "is" a machine, and therefore cheaper to buy
and not make.
> 2. There is (according to web sources) a built in gcc class called
> Integer. However, my Mac version of gcc doesn't compile any code with
> "Integer" undeclared.
>
Since the alternative is too horrible to contemplate, I assume that
your mac gcc doesn't compile with Integer declared, not the other way
around.
You sure it's not integer lower case, or some insanely cute variant
such as inTeGer (C's case sensitivity is, to paraphrase/repeat what
Dijkstra said of PL/I, a mistake, carried through to perfection).
Perhaps you only need to #include some library to get integer.
> 3. GNU MP seems promising. I've built it for my Mac G4, into its own
> directory. Now, being a UNIX/gcc novice, I can't compile any of the
> test GNU MP programs using XCode. It won't build anything without a
> project file, and if I create a dummy project file it can't find all the
> #included files.
>
> I've been trying for weeks to do this. How much would it cost me to get
> a programmer to make me a project (VC or XCode) which can compile and
> run a basic test program using arbitrarily large integers? How do I
> hire someone to do this?
Feel free to pay Pinnacle for a subscription (or get a free trial),
download my Visual Basic object, and call it from VC. However, you may
have some trouble with the fact that the object deals in VB strings.
I think you should go ahead with custom code if only to get something
DONE. Sure, it's been done. At the same time, you have been waiting
weeks for results, therefore for you it hasn't been done.
[They used to say, it can be done. Now they say, it's been done. I
say do it.]
Nash's solution that I assisted him with used 32 bit integers and
sensed overflow to carry the value to the next integer in an array.
Things get gnarly once you consider division and signs.
A big mistake is brute force. For example, I was able to get division
working in reasonable (not superfast) time, by simulating the
algorithm for long division in which you "guess" the quotient...not
repeated subtraction.
This was nothing more than Knuth's solution.
Like you, when I implemented the VB solution for the Pinnacle article,
I was scared of mistakes. Therefore the object will check its work by
executing the inverse operation until you set the property that tells
it to knock it off.
- Next message: Randy Howard: "Re: what does "serialization" mean?"
- Previous message: Phlip: "Re: how can i evaluate...?"
- In reply to: Richard Cavell: "Big integer arithmetic"
- Next in thread: Bill Unruh: "Re: Big integer arithmetic"
- Reply: Bill Unruh: "Re: Big integer arithmetic"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|