473,387 Members | 1,757 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,387 software developers and data experts.

How to expand my compiler's ULONG_MAX ?

Sorry for beeing ignorant - I'm a beginner.

I use Microsoft Visual C++, version 6.0.
A variable of type 'long integer' can store values no more than 2.1 bln.
However, I'd like to work with a substantially higher numbers, say,
consisting of 30 - 40 digits (just trying to develope some primitive
approach to RSA-problem).
Please advise me if there any methods or programming tricks to resolve
the problem.

Thank you. Sincerely,

Victor Goban.

vg****@verizon.net

August 18, 2004.

Jul 22 '05 #1
5 2515
victor goban <vg****@verizon.net> wrote:
Sorry for beeing ignorant - I'm a beginner.

I use Microsoft Visual C++, version 6.0.
A variable of type 'long integer' can store values no more than 2.1 bln.
However, I'd like to work with a substantially higher numbers, say,
consisting of 30 - 40 digits (just trying to develope some primitive
approach to RSA-problem).
Please advise me if there any methods or programming tricks to resolve
the problem.


It's a bit off topic since it doesn't deal with the C++ Standard in
any way.. but the language itself cannot handle numbers larger than
that as that is all the registers in your CPU can handle. You would
probably want to consider either writing your own "BigInt" class to
handle such values, or Google up a BigInt class/library already written.

--
Kristofer Pettijohn
kr*******@cybernetik.net
Jul 22 '05 #2
On 19 Aug 2004 01:04:15 GMT in comp.lang.c++, kr*******@cybernetik.net
(Kristofer Pettijohn) wrote,
.. but the language itself cannot handle numbers larger than
that as that is all the registers in your CPU can handle.


Nonsense. A conforming C++ compiler must generate code to handle
numbers larger than the CPU registers, if those registers are smaller
than 32 bits. Meanwhile, compilers implementing 64bit types on 32bit
CPUs are becoming common, e.g http://www.digitalmars.com

Jul 22 '05 #3

"victor goban" <vg****@verizon.net> schrieb im Newsbeitrag
news:kcSUc.21791$iE3.13780@trndny09...
Sorry for beeing ignorant - I'm a beginner.

I use Microsoft Visual C++, version 6.0.
A variable of type 'long integer' can store values no more than 2.1 bln.
However, I'd like to work with a substantially higher numbers, say,
consisting of 30 - 40 digits (just trying to develope some primitive
approach to RSA-problem).
Please advise me if there any methods or programming tricks to resolve the problem.

Thank you. Sincerely,

Victor Goban.

vg****@verizon.net

August 18, 2004.


With MSVC 6.0 you could also use the
Microsoft specific __int64 type.
Jul 22 '05 #4
victor goban wrote:
Sorry for beeing ignorant - I'm a beginner.

I use Microsoft Visual C++, version 6.0.
A variable of type 'long integer' can store values no more than 2.1 bln.
However, I'd like to work with a substantially higher numbers, say,
consisting of 30 - 40 digits (just trying to develope some primitive
approach to RSA-problem).
Please advise me if there any methods or programming tricks to resolve
the problem.

Thank you. Sincerely,

Victor Goban.

vg****@verizon.net

August 18, 2004.


Search the web for "big number C++" which will
result in more than one library for large numbers.

Two popular libraries are GMP an OpenSSL.
Here is a link to OpenSSL. Look at the RSA and
bn(3) functions:
http://www.openssl.org/docs/crypto/crypto.html
--
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

Jul 22 '05 #5
On Thu, 19 Aug 2004 08:15:20 +0200, "Friedrich Neurauter"
<fr*****************@eunet.at> wrote:

"victor goban" <vg****@verizon.net> schrieb im Newsbeitrag
news:kcSUc.21791$iE3.13780@trndny09...
Sorry for beeing ignorant - I'm a beginner.

I use Microsoft Visual C++, version 6.0.
A variable of type 'long integer' can store values no more than 2.1 bln.
However, I'd like to work with a substantially higher numbers, say,
consisting of 30 - 40 digits (just trying to develope some primitive
approach to RSA-problem).
Please advise me if there any methods or programming tricks to

resolve
the problem.

Thank you. Sincerely,

Victor Goban.

vg****@verizon.net

August 18, 2004.


With MSVC 6.0 you could also use the
Microsoft specific __int64 type.

Some other compilers use long long int for 64 bit integers, but again
this is an extension to the standard and not portable.

As you are a beginner, it might be worthwhile writing your own big
integer class as a learning exercise.

rossum

--

The ultimate truth is that there is no Ultimate Truth
Jul 22 '05 #6

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

Similar topics

1
by: Adam Endicott | last post by:
I'm having some trouble using an HtmlListBox with a GridBagSizer. I'm not sure how best to explain what's happening, but it seems that every time my frame gets resized, the HtmlListBox grows...
1
by: James Hurrell | last post by:
Hi, I'm using the following javascript function to expand and collapse portions of text in a web page (targeted at IE5.5 and above): function doExpand(paraNum,arrowNum) { if...
8
by: 2centbob | last post by:
Has anyone had an issue with SQL Server not being able to expand against a RAID 5 file system? My current configuration is that the server is started and stopped using the local system account. I...
1
by: Randy Starkey | last post by:
Hi, Is there a way to expand and collapse all if I have multiple implementations of this script on a single page? The script works well individually. Thanks! --Randy Starkey ---
7
by: No Spam | last post by:
----snip #define POSITIVE_INTEGRATOR_SATURATION 0x03000000L // #define NEGATIVE_INTEGRATOR_SATURATION 0xFD000000L // long integrator; integrator=0;
4
by: Karim El Jed | last post by:
Hi, I'm trying to expand a special Node of my TreeView from Codebehind. I have a TreeView on a page for navigating to another site. On the other tsite here is the same TreeView more precisely a...
0
by: Shadow Lynx | last post by:
When using ASP.NET 2.0's built-in TreeView on a page with <BASE target = "AnythingBut_Self"></BASE> in the HEAD, the expand/collapse buttons fail to function. The reason for this is that the...
7
by: Benzi Eilon | last post by:
I am executing an Expand command in order to expand a CAB file. This is done by calling CreateProcess with the Expand command and then WaitForSingleObject and checking the process exit code. My C++...
11
by: Nospam | last post by:
I don't know what it is I am doing wrong, I am trying to get the menus to either expand or contract based on their previous states, i.e if already expanded if clicked again contract, and if...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...

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.