472,811 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,811 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 6607
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.