This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Rare/Unique requirement

Hey dude,

I need some code to do some big math.

Like 12345678901234567890 x 987654321987654321

Must be in C and must be documented correctly.

Has anybody got some sourcecode?


  • I need some code to do some big math.

    Define "big". As in "how many bits does the biggest number that will every occur have".

    Like 12345678901234567890 x 987654321987654321

    That would amount to multiplying two 64-bit integers to get a 128-bit result. Since the compiler can natively work with 64-bit integers, this means four multiplications, some additions, and some overflow checking. Unfortunately, the latter is much easier (since it's pretty much automatic) in assembly than in C (where it requires extra checks).

    Has anybody got some sourcecode?

    Please specify your requirements more clearly. What's the bit width of the numbers you're working with, which arithmetic operations do you require, etc.