implementation of atoi

F

freek

Hello,

I need to convert a large string (98765432108569321475963014587952) of
32 characters to an 128bit integer. I must use 128bit integer as a
combination of 64 bit integer but not with some libraries.

Thank you for any help
 
T

Tom St Denis

Hello,

I need to convert a large string (98765432108569321475963014587952) of
32 characters to an 128bit integer.  I must use 128bit integer as a
combination of 64 bit integer but not with some libraries.

Thank you for any help

Is this a homework assignment and that's why you can't use a library?
If so, why would we help you anyways?

The real answer is higher precision [fixed or multi] math. Invent a
way to multiply by a constant [such as 10] then invent a multi-word
add-with-carry, then the problem is much simpler.
 
B

Ben Bacarisse

freek said:
I need to convert a large string (98765432108569321475963014587952) of
32 characters to an 128bit integer. I must use 128bit integer as a
combination of 64 bit integer but not with some libraries.

First, write your own atoi using ordinary integer arithmetic. If you
have trouble with that, post your best effort here (or maybe in
alt.comp.lang.learn.c-c++).

After you've done that, it should be clear what operations you need to
provide for your 128-bit integer type.
 

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

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top