Computing.Net > Forums > Programming > 64-bit integers in C?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

64-bit integers in C?

Reply to Message Icon

Name: Leo the 28C (by Sulfurik)
Date: July 29, 2006 at 16:16:31 Pacific
OS: Must work at least on DOS
CPU/Ram: Varying.
Product: Varying.
Comment:

Hello everyone!
Hey... I need to handle big numbers (several gigabytes) in C (must be plain ol' C, no C++ or anything), but 32-bit integers can't handle that... The long long type of C99 (I need C89, so that's not a choice, but I tried it anyways...) doesn't work either... Does anyone know any way to do this? Thanks!

-- Leo



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 30, 2006 at 00:14:59 Pacific
Reply:

I dunno C, but that homepage link sounds interesting. BUT it didn't load.

http://tsfc.ath.cx/

this:

http://ath.cx/

takes me to dynDNS



If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: sickinthebox
Date: July 31, 2006 at 00:27:22 Pacific
Reply:

It might be kind of a pain, but you could try using two 32-bit integers to represent one number, and concatinate them. I'm not that familiar with C, but if you did it this way, you would have to be careful while making calculations.

~Ben;


0

Response Number 3
Name: Fel
Date: July 31, 2006 at 18:05:37 Pacific
Reply:

you can try to make an abstract data type, but you have to make each function for the +, -, * and / operator.
by using ADT you can make limitless integer.

Athlon 64 2800+ @ 2.63 Ghz Stock Cooling
Timings:2-3-2-5
V-Gen 512MB pc3200 x 2
DFI Lanparty UT NF3
Abit R9550 VGuru XTurbo
525Mhz/300Mhz


0

Response Number 4
Name: Piksou
Date: August 1, 2006 at 06:44:07 Pacific
Reply:

01-08-2006

------ POINT 1
From http://blogs.msdn.com/calvin_hsia/archive/2005/03/18/398749.aspx

LONG is a 32 bit quantity, whereas LARGE_INTEGER is defined in Winnt.H as a Union

typedef union _LARGE_INTEGER {

struct {

DWORD LowPart;

LONG HighPart;

};

struct {

DWORD LowPart;

LONG HighPart;

} u;

LONGLONG QuadPart;

} LARGE_INTEGER;


typedef LARGE_INTEGER *PLARGE_INTEGER;


The HighPart is 32 bit signed and the LowPart is 32 bit unsigned. Put them together and you have a 64 bit signed number....

------ POINT 2
[in the mingw32 distribution 3.4.4

see winnt.h
see largeint.h for LargeIntegerAdd (LARGE_INTEGER ,LARGE_INTEGER )

]

I hope this will help you.
P.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: 64-bit integers in C?

128-bit integers www.computing.net/answers/programming/128bit-integers/6846.html

help me in C++ www.computing.net/answers/programming/help-me-in-c/2812.html

To Run C,C++ Language in XP-64 bit www.computing.net/answers/programming/to-run-cc-language-in-xp64-bit-/17883.html