473,394 Members | 1,724 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,394 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 6642
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.