473,394 Members | 2,052 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.

how to manipulate integers very very large?

i am a beginner .can you give me idea how we can manipulate "LARGE" integers (positive or negative) of arbitrary size. These integers could be greater than MAX_INT or smaller than MIN_INT.

using arrays or string?
Sep 27 '08 #1
5 1754
JosAH
11,448 Expert 8TB
Just use the BigInteger class.

kind regards,

Jos
Sep 27 '08 #2
i mean without using bigintegers and number can be greater than big integer also...............i.e 999999999999999999999999999999999999999
Sep 27 '08 #3
JosAH
11,448 Expert 8TB
i mean without using bigintegers and number can be greater than big integer also...............i.e 999999999999999999999999999999999999999
Do you mean you want to use big integers but you don't want to use the BigInteger
class? How strange ... can you explain why you want to restrict yourself?

kind regards,

Jos
Sep 27 '08 #4
i want to know how it works because i am making progamme in ocaml to calculate big integers without using any directories........pls help .....give me idea....how i can add two big integer in two different list or array????????????
Sep 28 '08 #5
JosAH
11,448 Expert 8TB
i want to know how it works because i am making progamme in ocaml to calculate big integers without using any directories........pls help .....give me idea....how i can add two big integer in two different list or array????????????
A BigInteger doesn't use any directories; I don't know who told you that. The
following example calculates 1000! (factorial). See how simple it is:

Expand|Select|Wrap|Line Numbers
  1. BigInteger fac= BigInteger.ONE;
  2. for (int i= 2; i <= 1000; i++)
  3.    fac= fac.multiply(new BigInteger(""+i));
  4. System.out.println("1000! = "+fac);
  5.  
Read the API documentation for this class and see how one of its constructors
can create a BigInteger given some other representation of such a number.

kind regards,

Jos
Sep 28 '08 #6

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

Similar topics

29
by: Chris Dutrow | last post by:
I searched around on the net for a bit, couldn't find anything though. I would like to find some code for a function where I input A Range Of Integers For example: Function( 1, 100 ); And the...
2
by: Madhusudhanan Chandrasekaran | last post by:
Hi: This question is not directed "entirely" at python only. But since I want to know how to do it in python, I am posting here. I am constructing a huge matrix (m x n), whose columns n are...
13
by: bob | last post by:
If you were designing a class to represent very large integers in C++, what kind of internal representation would be best?
1
by: susheela s | last post by:
Hi, Im doing a multiplication of two large integers which are store in arrays(such as 2345 is in array as 2 in a, 3 in a and so on)like this im storing integers in two arrays.The logic i have used...
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
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...
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.