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

very very very long integer

You can implement very very long integer using strings. Strings have
no limit and using your own code implementation you can store the
numbers of as much length as you want..........for more details
contact at ab***********@yahoo.co.in
Nov 14 '05 #1
4 2287
Abhishek Jha wrote:
You can implement very very long integer using strings. Strings have
no limit and using your own code implementation you can store the
numbers of as much length as you want..........for more details
contact at ab***********@yahoo.co.in


But how would u perform the arithmetic operations
if you are storing them as strings.

--
Karthik. http://akktech.blogspot.com .
' Remove _nospamplz from my email to mail me. '
Nov 14 '05 #2
Karthik Kumar wrote:
Abhishek Jha wrote:
You can implement very very long integer using strings. Strings have
no limit and using your own code implementation you can store the
numbers of as much length as you want..........for more details
contact at ab***********@yahoo.co.in

But how would u perform the arithmetic operations
if you are storing them as strings.

You can do that without any problems:
"12345"
+
"12345"

Start at the end:
Carry = 0

loop:
('5' - '0') + ('5' - '0') ==> result 10

write Carry + '0' + result%10 to output string.

Carry = result/10,

goto loop;

Some bignums libraries use this representation.
Nov 14 '05 #3
jacob navia wrote:
Karthik Kumar wrote:
Abhishek Jha wrote:
You can implement very very long integer using strings. Strings have
no limit and using your own code implementation you can store the
numbers of as much length as you want..........for more details
contact at ab***********@yahoo.co.in


But how would u perform the arithmetic operations
if you are storing them as strings.

You can do that without any problems:
"12345"
+
"12345"

Start at the end:
Carry = 0

loop:
('5' - '0') + ('5' - '0') ==> result 10

write Carry + '0' + result%10 to output string.

Carry = result/10,

goto loop;

Some bignums libraries use this representation.

Apparently that seems less efficient in terms of computation
complexity compared to a linked list. The reason is here -
at any given time, we are processing one digit. Whereas when represented
as long, we can process a good number of digits at any given time , more
than 1.

--
Karthik. http://akktech.blogspot.com .
' Remove _nospamplz from my email to mail me. '
Nov 14 '05 #4
Karthik Kumar wrote:
jacob navia wrote:
Karthik Kumar wrote:

Apparently that seems less efficient in terms of computation
complexity compared to a linked list. The reason is here -
at any given time, we are processing one digit. Whereas when represented
as long, we can process a good number of digits at any given time , more
than 1.


Yes. But it is easier to handle than binary, and binary-->decimals
conversions are very cheap... nothing needs to be done.
Nov 14 '05 #5

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

Similar topics

14
by: Allcomp | last post by:
Hello, I have seen something really strange in VB6 If I do a Int ( (5 * 1.2)) , I receive the value 5, but I should receive 6? Is this a bug or something really "normal". I can see that if I...
45
by: Trevor Best | last post by:
I did a test once using a looping variable, first dimmed as Integer, then as Long. I found the Integer was quicker at looping. I knew this to be true back in the 16 bit days where the CPU's (80286)...
19
by: shanx__=|;- | last post by:
hi i need some help regarding use of very very long integer datatype in 'c'.. i need it to store result of large number's factorial.. if someone can healp it would be a delight..
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
12
by: Jack Daly | last post by:
I've inherited some code which uses an undocumented feature of a third-party vendor's library. Essentially, this vendor has kept the details of an interface struct secret, but we can pass a pointer...
13
by: Jack B | last post by:
I'm using Access 2002 to create a database for a small opera company that my wife is involved in, and I'm more than a bit rusty because I haven't created a new Access database since about 1999. ...
12
by: Ahmad Jalil Qarshi | last post by:
Hi, I have an integer value which is very long like 9987967441778573855. Now I want to convert it into equivalent Hex value. The result must be 8A9C63784361021F I have used...
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
0
by: zephyrus360 | last post by:
This is about a technique to find the mod of a very large integer with a normal small integer. I recently encountered this problem when I needed to compute the modulus of a very large number with...
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?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.