Working with extremely large numbers in C


 
Thread Tools Search this Thread
Top Forums Programming Working with extremely large numbers in C
# 1  
Old 05-05-2011
Working with extremely large numbers in C

Hi All,

I am just curious, not programming anything of my own. I know there are libraries like gmp which does all such things. But I really need to know HOW they do all such things i.e. working with extremely large unimaginable numbers which are beyond the integer limit. They can do add, subtract etc.

I have thought of one way which is instead of int, store the numbers in the character array of any length and while computing, keep changing each and every char to int and hence perform an operation.

Are there any other better ways of handling large integers in C program?
# 2  
Old 05-05-2011
Use objects (struct, array) of integers, implementing carry operations in software rather than in hardware.
This User Gave Thanks to jim mcnamara For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse for 2 numbers in large single line

Hi All, I am writing a script in which I need to gather 2 numbers for 'total' and 'successful'. The goal is to compare the two numbers and if they are not equal, rerun the task until all are successful. I'm thinking the best way will be with awk or sed, but I really don't know where to begin... (8 Replies)
Discussion started by: hburnswell
8 Replies

2. Solaris

Editor for working with large files

Hi, We have file which is about 756 MB of size and vi/vim do not work when we try to edit this file. I'm looking for any editor ( ok if its NOT free ) which has the ability to open/edit a file of 1+GB seamlessly. The OS is SUN Solaris 10 ( Sparc ) Thanks in Advance Maverick (13 Replies)
Discussion started by: maverick_here
13 Replies

3. Shell Programming and Scripting

Adding Long List Of Large Numbers

Hi All, I have a file with long list of numbers. This file contains only one column. These numbers are very large. I am using following command: cat myfile.txt | awk '{ sum+=$1} END {print sum}' The output is coming in scientific notation. How do I get the result in proper format? ... (4 Replies)
Discussion started by: angshuman
4 Replies

4. UNIX for Dummies Questions & Answers

Find common numbers from two very large files using awk or the like

I've got two files that each contain a 16-digit number in positions 1-16. The first file has 63,120 entries all sorted numerically. The second file has 142,479 entries, also sorted numerically. I want to read through each file and output the entries that appear in both. So far I've had no... (13 Replies)
Discussion started by: Scottie1954
13 Replies

5. UNIX for Dummies Questions & Answers

Hope to create a file with two large column, with several numbers

I hope to create a file made up of 2 columns - first column print out number 0~61000 every 50 of it - second column just contains 0 delineated by space such as 0 0 50 0 100 0 150 0 200 0 ... 60900 0 60950 0 61000 0 Which command should I need to use? I think I might need to use... (5 Replies)
Discussion started by: exsonic
5 Replies

6. Shell Programming and Scripting

sed and awk not working on a large record file

Hi All, I have a very large single record file. abc;date||bcd;efg|......... pqr;stu||record_count;date when i do wc -l on this file it gives me "0" records, coz of missing line feed. my problem is there is an extra pipe that is coming at the end of this record like... (6 Replies)
Discussion started by: Gurkamal83
6 Replies

7. Shell Programming and Scripting

Moving extremely large number of files to destination

Hello Techies, m here with a small issue. Have read out all the relavent threads on unix.com but it was not so good sol. for me. It's a simple & known issue. I want to move lots of files to dest folder. Actually I want to pick up 1 year older files, but that is even taking lots of... (16 Replies)
Discussion started by: kedar.mehta
16 Replies

8. UNIX for Dummies Questions & Answers

Grep alternative to handle large numbers of files

I am looking for a file with 'MCR0000000716214' in it. I tried the following command: grep MCR0000000716214 * The problem is that the folder I am searching in has over 87000 files and I am getting the following: bash: /bin/grep: Arg list too long Is there any command I can use that can... (6 Replies)
Discussion started by: runnerpaul
6 Replies

9. UNIX for Advanced & Expert Users

Planning on writing a Guide to Working with Large Datasets

In a recent research experiment I was handling, I faced this task of managing huge amounts of data to the order of Terabytes and with the help of many people here, I managed to learn quite a lot of things in the whole process. I am sure that many people will keep facing these situations quite often... (2 Replies)
Discussion started by: Legend986
2 Replies

10. Shell Programming and Scripting

How to parse large numbers of shell scripts

I am trying to parse hundreds of shell scripts to determine how they related to each other. Ideally for every script, I would get an output of: What other scripts it calls What files it reads Environment variables it accesses Any ideas on how to do this? TIA! (2 Replies)
Discussion started by: bliss
2 Replies
Login or Register to Ask a Question