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

Division with two Huge Integers

How to Divide a Huge Integer?

e.g.
99999999999/221321321321321
May 7 '08 #1
4 2063
Banfa
9,065 Expert Mod 8TB
The same way you divide any other integer, divide 1 variable by another and store the result in a third.

May be you should be more specific.
May 7 '08 #2
manontheedge
175 100+
you can't divide those two as integers. The result is less than one, so it will return 0.

If you want an actual decimal value, you have to use double or float and not integer variables
May 8 '08 #3
gpraghuram
1,275 Expert 1GB
How to Divide a Huge Integer?

e.g.
99999999999/221321321321321

I think u shuld use unsigned long long variable type to store the values u are using.
gcc supports this

Raghuram
May 8 '08 #4
dtimes6
73
This sounds that you integer is stored in another form, so one method is to implement an structure use operator overloading to handle the case. you should provide you own algorithm of divide. one stupid way is sub if leftexpr is larger then the rightexpr and add the result by one. Please take care for the case c/0. And Good luck!
May 23 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: Teis Draiby | last post by:
In .NET, can I be sure that the result of a division between two integers always is truncated rather that rounded to nearest? Example: 99 / 50 = 1 regards, Teis
2
by: Darius Fatakia | last post by:
hi, i'm new to MS Visual Studio and C++ but not to C programming in general. i'm trying to divide two integers and get their actual quotient (eg 5/3 = 1.666667 etc). i thought i had type cast...
8
by: nineteen | last post by:
for example: 16/5: 3 -------- 5)16 15 -------- 1 the user input the dividend and divisor,the program should display the upright formula like the example. and , the program must use recursive...
9
by: PengYu.UT | last post by:
Hi, The usually integer division will round the result to the biggest integet smaller than the float version division.For example, 10/3 = 3. I'm wondering if there is any easy way to round it...
13
by: jamesonang | last post by:
Supposed unsigned int(32 bits) is the largest number that computer can represent with a single variable. Now, i have a big integer ( less than 64 bit, but great than 32 bit) . i represent it by...
9
by: Joe Cool | last post by:
Hello, I am using VS2005. I am trying to convert a VB.NET app to C#.NET. The VB app uses a progress meter to indiate how far a file has been read. I use the following assignment statement in VB: ...
9
by: jm.suresh | last post by:
Hello all, I have two integers and I want to divide one by another, and want to get an integer result which is the higher side whenever the result is a fraction. 3/2 =1 # Usual behavior...
2
by: skip | last post by:
Running from Subversion, I see confusing (to me) behavior related to division of datetime.timedelta objects by integers: % python Python 2.6a0 (trunk:57277:57280M, Aug 28 2007, 17:44:49) on...
4
by: Astley Le Jasper | last post by:
I've been getting errors recently when using pysqlite. I've declared the table columns as real numbers to 2 decimal places (I'm dealing with money), but when doing division on two numbers that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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$) { } ...
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,...
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...

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.