64-bit integers support

  • Thread starter Vladislav Borovikov
  • Start date
V

Vladislav Borovikov

Hi all!

I use C compiler, which doesn't support operations with 64-bit
integers. Of course, I should use a structure with two 32-bit words
instead of a 64-bit integer. But how to implement basic arithmetic
operations such as multiplication and division? It's too difficult for
me. Do you know any algorithms for that purpose?
Maybe somewhere can be found a source code in the public domain?

Thanks in advance,
Vladek.
 
R

Robert Gamble

Hi all!

I use C compiler, which doesn't support operations with 64-bit
integers. Of course, I should use a structure with two 32-bit words
instead of a 64-bit integer. But how to implement basic arithmetic
operations such as multiplication and division? It's too difficult for
me. Do you know any algorithms for that purpose?
Maybe somewhere can be found a source code in the public domain?

Your best bet is probably to try to find a compiler for your platform that
supports 64-bit integers or use a Big-Num library. You didn't mention
your platform but the open source GMP library might meet your needs, it is
available at http://swox.com/gmp/. A Google search would turn up
additional results.
Thanks in advance,
Vladek.

Rob Gamble
 
T

Tor Rustad

Vladislav Borovikov said:
Hi all!

I use C compiler, which doesn't support operations with 64-bit
integers. Of course, I should use a structure with two 32-bit words
instead of a 64-bit integer. But how to implement basic arithmetic
operations such as multiplication and division? It's too difficult for
me. Do you know any algorithms for that purpose?
Maybe somewhere can be found a source code in the public domain?

Do a search for multi-precision library... GNU MP is one, personally
I have used Lenstra's freeLIP package, which is _very_ fast.

However, if you primary want to learn doing the MP calculations
yourself, take a look in "Numerical Recipes in C".. the book is
available online, and has simpler algorithms than what freely has.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top