Programming :: Maximum Digits In The GMP?
Mar 27, 2011how much big number can be managed by gmp library under plain GCC environment? (does GMP cover infinite length of integer?)
View 1 Replieshow much big number can be managed by gmp library under plain GCC environment? (does GMP cover infinite length of integer?)
View 1 RepliesI'm having a hard time trying to get the number of digits in a uint64_t variable. The reason I'm using this is I want to make sure I get x amount of digits inside of a variable before I use it, but since the higher the digits, the better the program is.I currently use the following code, and it works, but my loop will never exit because the length is always 0:
Code:
/**
* numbdigits()
* number: The number to evaluate [in]
*
* Returns the number of digits found in a number.
[code]....
getrand() returns a uint64_t as well (and works). The only way the while() loop ends without my intervention is if I do curd += numdigits(val) instead...but, that gives a false value as well.
I am trying to replacee all digits with a symbol (say, big U here) in a string by
[code]...
The result become 'UsUoUmUeUtUhUiUnUgU' instead of 'somethingUUU' as expected. Looks like my string contains some 'hidden digits' in between the letters. Does anyone have an idea about that?
I am having a huge problem checking the data I input to make sure it is correct. What I am trying to achieve is when I input a value, it will check if the input is all digits and if it is not, check to see if it contains certain alphabets. Thus for example, if I were to input in data such as "11A" , the program will then inform me "There is an important alphabet in the program." This would be my expected output. Here is the program I have wrote...
Code:
int test(string r ){ const int arraySize = 10;
char array2[arraySize2] ={'A','B','E','F','G','H','J','K','N','O','P','Q','R','S','T','U','W','Y','Z'};
for(int cntr = 0; cntr <r.length(); cntr++)
if(!isdigit(r[cntr])){ for(int new1 =0; new1<arraySize2;new1++)
for(int cntr1 = 0; cntr1 <r.length(); cntr1++)
if(array2[new1] == r[cntr1]){ return 2; //will return2 when it finds the same
// char in the array and the string r. } else{ return 3;
//will return 3 when there is a char
//in the string which isnt in the array
} } else { return 1; // will return 1 when string is all digit.
} int main() { string r = "11D"; test(r);
if(test(r) == 1) { cout << "ALL ARE DIGITS" << endl;
} if (test(r)== 2) {
cout << "There is an important alphabet in the program." << endl;
} if (test(r)== 3) { // testRoman(r);
cout << "There is an Alphabet in the String which is not in the Array" << endl;
} }
So, the problem I am facing is when I input in data such as 11 or A , the prog will come out the right input. But if I were to put in data such as "11A" , the output coming out will be "ALL ARE DIGITS". The problem which causes this seems to be in the return statement , as once as it finds the first char which is a digit, it will then return 1 and not continue checking the rest of the string. Is there a way I can stop or continue a loop if it has met the condition I stated? What I can do or any other way available for me to check my input?
My problem is this:I have a number of directories, all containing files of different name lenghts, including letters, numbers and possibly spaces. I want to recursively rename all of these files, so that only the _last_ 5 digits (not counting the extension) remain. In other words: I want to cut off all but the last 5 digits and not touch the extension.
I've tried to read up on tr, rename (perl version), sed, cut etc. and browsed through some threads here, but so far couldn't quite figure out how to do it.
If someone could point me to the right (standard) CLI tools and syntax.
I'm trying to build a multi-threaded server "C" program connecting to multiple clients. For various design reasons, I thought of having one port number per client. What is the maximum number of ports my process can handle
View 5 Replies View RelatedIs there any maximum limit to the heap memory allocation?My program is in PERL and i am using a solaris system. when i did "pmap pid" (pid = my process id) it is showing a number of heap memory allocated and all of them with GB sizes. This single process is eating up most of the physical memory.Is it normal and is there any way to get the heap memory size down
View 3 Replies View RelatedHow to restrict the maximum size of an array variable in perl such that Ishould not be able to have array elements beyond the maximum size?
View 7 Replies View RelatedI want to find maximum length file in a given directory. It should search recursivley. I want this to be done using ls and simple looping constructs.
View 6 Replies View RelatedI am trying to write a program that gets file permission. I understand linux has ls -l can view file permission, but it has too many information that I have to process those strings in my program. Is there an easier command just return me the permission digits like:
$ getperm /home/file
0440
$
I have many files with name in order of number. e.g)
u0101.asc
u0102.asc
u0103.asc
[code]...
I am trying to read file using for loop.
for ((date=01; date<=31; date++))
do
echo ${date}
done
but '01' is read(print) as '1' How can I make it read from '1' to '01'?
I want to count the digits in between the text in a file.
e.g.
write down the form
2.3 3.3 3.0 505.0 0.777E-07
22.3 3.3 5.0 503.0 1.777E-04
Then read this.
How can i do the counting of these digits present in between a text in a file?
How can I set my processor fan to 100% in linux?
View 1 Replies View RelatedWhen connected to a Wireless network, how can I use the maximum bandwidth in the network as I am finding that my network speed is degrading day by day as more users are logging onto the network. Btw, I am using Natty Narhwal.
View 1 Replies View RelatedI want to know what is the maximum no of processes that can be run in Linux ,as it is a multitasking so what is the limit of this.
some one told me that 8192 but why this not 10000 or 500 why 8192.
Is there a maximum requests per second that CentOS can handle? For example, a site like wikipedia gets at least 30,000 requests per second, so could CentOS handle that many requests? Some people told me that CentOS cannot and i would need to get a custom kernel.
View 10 Replies View RelatedI will be upgrading my RAM soon. What is the maximum amount of ram a 32bit OS can see?
View 14 Replies View RelatedI hava a ASUS P5GC-MX/1333 and I want to install the driver from my Realtek audio, because, in windows 7 the volume is very loud, but in fedora even in the maximum is very low.
View 10 Replies View RelatedMY current screen resolution is 1200X800 but from my monitor manual I can see that it support these resolution also 1366X768, 1280X960, 1280X1024 but there is no such option to change in my fedora 12. How can I change that?
View 14 Replies View RelatedI was wondering what is the maximum number of partition on an GPT-partitionned drive under Linux. The GPT partition table can contain up to 128 partitions, but the device nodes for /dev/sda? (as described here, block device of major number 8) only allow /dev/sda1 up to /dev/sda15. Does that means that there cannot be more that 15 partitions on a drive, even on a GPT-partitionned drive?
View 2 Replies View RelatedI used to have Windows on my laptop, until I got the blue screen, so I just installed ubuntu. Well everything was ALOT louder on Windows, and I was wondering if there was a way to increase the maximum volume. I have to turn the volume almost all the way up to watch a movie. On Windows 1/4 volume was plenty. I searched, but alot of the answers I saw were that it was hardware limitations, which cant be the case, since it was a ton louder on Windows
View 5 Replies View RelatedHow can I maximum the CPU usage for a process? And also use both cores if possible.
View 5 Replies View RelatedHow many users is it possible to set on Ubuntu 10.10? I have an Edubuntu LTSP system for a school (10 clients) and I wish to setup an user for each student/teacher (about 200).
View 2 Replies View RelatedI have a dual boot with windows 7 and ubuntu 11.04, I have installed this a couple times, so its not the first time it happens. My laptop is an acer 5678zg i think its called. I previously had 32 bit ubuntu and 64 bit now, same issueWhen I boot up ubuntu, my volume is sat at maximum which is really annoying since I have the sound through hdmi pass through via onkyo receiver and loudspeakers. Even when I turn volume down, the volume meter is not at top, but at where it was last time, but the volume is still at top and decreases to whatever volume I had at last time at first click on volume down.
View 9 Replies View Relatedhow to mkpart with maximum size available?
mkpart primary 0 3001G
I have 3TB raid disk. I cannot install centos using GPT partition. I need to use parted and mkpart to format it.
I am facing a problem in finding out the maximum value of a field using awk .. The field is of date format i.e. (MM/DD/YYYY) ..
The contents of the file is :
2/2/2011 XYZ
2/2/2011 XYZ1
2/3/2011 ABC
2/4/2011 ABC
[Code]....
I need to find the maximum of the first column i.e. my output should be 2/12/2011 ..
I was using the below awk script : awk 'n < $0 {n=$0} {print n}{print $0}' <source_file having the above data>
But the output I am getting is 2/9/2011 instead of 2/12/2011 ...
what could be reason for this output and how can I get my desired result ..?
My laptop brightness gets set to maximium each boot.
Just wondering if this is the case for other laptop users. I have a Lenovo Thinkpad SL500 (GeForce 9300M GS) and am running Testing.
Ideally I'd like it to remember my last setting (which is usually the lowest). It'd be nice not having to turn it down each time I reboot/power-on.
It actually starts off at a low setting but during the boot process (before gdm and just after the "Waiting for /dev" line I believe) it suddenly gets set to max.
I have both cpufrequtils and acpi-whatevercpu, normally processor would be correctly controlled by the ondemand governor and have two steps for frequency, 1.4 and 3.5GHz. Now I've noticed my frequency is always at 3.5GHz, cpufreq-info gives me the hint:
Code: Select allguiu@guiu-desktop:~$ cpufreq-info --cpu 0
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org.
[Code].....
This isn't really a big issue. Normally the processor will sit at +-28°C at low load levels at maximum frequency, with the proper governor it will drop to +-20°C (room temperature) and lower. So I still would like to get proper management of frequencies for more hardware life, and better energy efficiency, not to mention quieter fans. Documentations on cpufrequtils is very broad, and apart from that I don't know where to look for this. Debian wiki page mentions about a file that can be used to configure this but there isn't much documentation.
Ps: I previously had this issue where acpi-cpufreq driver wouldn't load at all, this is due to setting on bios resulting in different frequencies than stock, trying to get default frequencies allowed the driver to work.
I have a brand new computer with an ATI Radeon HD5850 video card I have a LCD monitor with a native resolution of 1920x1080. I installed Debian Testing 2.6.32-5-amd64
Because I have several machine, I use a KVM (switch keyboard) in the middle. This KVM is quite old but still work correctly only problem is that it don't forward the EDID information. Until now it wasn't a problem, and by specifying the correct parameters of the monitor in /etc/X11/xorg.conf , I always succeed to reach the 1920x1080 resolution
In installed the proprietary drivers from ATI Catalyst 10.6 (last version)
since I have 2 problems :
first in the console I used framebuffer in 1280x1024x32. Before installation of the ATI drivers, it was ok, now the screen is completely black !! on every tty (I didn't investigate much on this trouble yet)
Second problem:
I can't reach the native resolution of my monitor ! No matter what I'm doing, the best the driver propose is 1600x1200 !!
I made a lot of test and modification in xorg.conf but without success, it always goes back to this resolution and never propose something higher For information, if I connect the monitor directly to the video card (removing the KVM), everything is OK and the resolution is automatically set to 1920x1080
/etc/X11/xorg.conf
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
EndSection
[Code].....
Is there a limit to the number of files ext3 can support?
Reason I'm asking is because on one of my internal drives, I have around 750,000 files. The drive is 500Gb and currently using 150Gb... I noticed recently that when I try to copy a new directory or file, the transfer rate is extremely slow at times. It is sataII and sometimes it gets as low as 500kb/s (yes, kb!)
Would somebody please shed some light?
I noticed it might be related to the process gvfsd-metadata
I'm using Fedora 12 64-bit
The transfer is from an ext3 to ext3 filesystem.