473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Something like bigint / GMP?


Hi, is there some small project that proviedes bigint, best as a C++ class,
or just as set of struct/functions (C-style)?

Something like GMP and it's bigint, but I want to have it just in one small
source file as small as needed, not to have entire advanced GMP library.

--
Rafał 'Raf256' Maj
Jul 23 '05 #1
5 6644
Rafał Maj Raf256 wrote:
Hi, is there some small project that proviedes bigint, best as a C++ class,
or just as set of struct/functions (C-style)?

Something like GMP and it's bigint, but I want to have it just in one small
source file as small as needed, not to have entire advanced GMP library.


Do you want a C++ library or a C library?

Also, please don't post separately to many groups.
If you need to do that, put them all on the "To:"
field (or CC) when you post. That way, everybody
from all the newsgroups can see everybody else's
replies.

See my reply in news:comp.lang.c.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
Jul 23 '05 #2

"Rafał Maj Raf256" <sp**@raf256.com> wrote in message news:1614105.DxINQP7ihL@raf256com...

Hi, is there some small project that proviedes bigint, best as a C++ class,
or just as set of struct/functions (C-style)?

Something like GMP and it's bigint, but I want to have it just in one small
source file as small as needed, not to have entire advanced GMP library.

[snip]

Look at C++ BigInt class
https://sourceforge.net/projects/cpp-bigint/
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
Jul 23 '05 #3
Alex Vinokur wrote:
Look at C++ BigInt class
https://sourceforge.net/projects/cpp-bigin


Thanx, it looks good, do You know perhaps what is the limit - can I use
1e32000 integers also?

--
Rafał 'Raf256' Maj
Jul 23 '05 #4
Rafa? Maj Raf256 <sp**@raf256.com> wrote in message news:<1614105.DxINQP7ihL@raf256com>...
Hi, is there some small project that proviedes bigint, best as a C++ class,
or just as set of struct/functions (C-style)?

Something like GMP and it's bigint, but I want to have it just in one small
source file as small as needed, not to have entire advanced GMP library.


Hello.

Multiprecision unsigned number template library (MUNTL).

http://sourceforge.net/projects/muntl/

This is C++ template library for unsigned big integer. This library
very small (only 25Kb one header). This library very fast because it
do not use any heap call (like new, malloc etc.). All buffers is
static compile-time allocate. This library do not use GMP.

Sincerely yours
Basil
Jul 23 '05 #5

"Rafał Maj Raf256" <sp**@raf256.com> wrote in message news:1966960.odmIdpGB8u@raf256com...
Alex Vinokur wrote:
Look at C++ BigInt class
https://sourceforge.net/projects/cpp-bigin


Thanx, it looks good, do You know perhaps what is the limit - can I use
1e32000 integers also?

[snip]
There is no logical limit.
Actual limit depends on specific machine resources.

Here is some test performed on Windows 2000.

/ ====== Test ======
int main ()
{
RossiBigInt result ("12", DEC_DIGIT);

for (int i = 0; ; i++)
{
ostringstream oss;
result = result * result * result * result * result;
oss << result;
cout << "The results contains " << oss.str().size() << " digits" << endl;
if (oss.str().size() > 32000) break;
}
return 0;
}
// ==================

// ====== Run ======

$ bigint.exe

The results contains 6 digits
The results contains 27 digits
The results contains 135 digits
The results contains 675 digits
The results contains 3373 digits
The results contains 16863 digits
The results contains 84312 digits

// =================
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn


Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: KK | last post by:
Hi, im working on this bigInt class. Need help writing algorithm for the operator*, andy help will be appreciated. Thanks in advance bigInt.h...
10
by: MK | last post by:
Hello, I use BigInt lib from: http://www.codeguru.com/Cpp/data/data-misc/values/article.php/c4563/ It doesn't work properly. I describe my problem:...
1
by: MK | last post by:
I need div two big int. I use this lib: https://sourceforge.net/projects/cpp-bigint/ I create simple project and include two file bigint.h and bigint.cpp (Precompiled headers is not using) When...
2
by: Jon | last post by:
Since there is no native support for 64bit integers in dbExpress, it is not trivial to fetch a BIGINT from SQL 2k. If it is possible, how can a BIGINT be fetched using TParam or TField? Any...
2
by: Marc Heravi | last post by:
Hello NG, for overflow reasons on numerical accumulation of an int column during SELECTion i have to change the data type of a column from "int" to "bigint". However that doesn't apply to the...
12
by: Rafał Maj Raf256 | last post by:
Hi, is there some small project that proviedes bigint, best as a C++ class, or just as set of struct/functions (C-style)? Something like GMP and it's bigint, but I want to have it just in one...
0
by: Dan Ruthers | last post by:
Hi, I have read in this list and elsewhere the problem with indexes and big int. Still, I have an index that is used or not, depending of the parameter value used in the query. I am using...
2
by: Dave Bazell | last post by:
I was using Math::BigInt and found that postive integers have a leading plus sign: +12345678900000 Is there a way to supress this? Thanks, Dave
0
by: SQLGuy | last post by:
My company had a partitioned view across 5 SQL 2000 and 2005 clusters, with 1.9B rows of data, with the key using datatype of int. At this point, we need to convert everything to bigint very soon. We...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.