|
How many number of connections have you made?.This limitation could be because of the limitation of the Access Driver. Close some connections and try again..
Regards,
Rane
|
|
|
|
|
Hi
I am writing a program in which a function generates Power of 2 .
I would like to generate say
for eg 2^100
But with int or long int i cant store and process the value.
Any Suggestions on storing and how to calculate the value will be of good help
Thanks
|
|
|
|
|
Use unsigned long long datatype and it can hold values up to 18,446,744,073,709,551,615.
Regards,
Rane
|
|
|
|
|
what if the value exceeds the above specified limit ??
|
|
|
|
|
Then you'll need to treat the numbers as strings instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Rane wrote: Use unsigned long long datatype
That only leaves 37 more bits required for the OP to get
an integer representation of 2^100
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Can you just give a sample code for the conversion.
Thanks in advance
|
|
|
|
|
I'm not sure what you're trying to do.
Your 2^100 example would take a 101 bit integer - there's
no built in C/C++ integer type that's that big.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am doing a calculation, in which i have to calculate the power of say(for e.g 2 ^ 100 , 2 ^150 etc) .
And i have to see if that 2^100 has a pattern of 777 in it.
so i am thinking of a logic to store this huge integer number.
Even if i use long int i can maximum store up to 2^64.
But i am thinking of storing them in character array ....
|
|
|
|
|
manoj_36 wrote: I am doing a calculation, in which i have to calculate the power of say(for e.g 2 ^ 100 , 2 ^150 etc) .
And i have to see if that 2^100 has a pattern of 777 in it.
Let me start with a word of warning about the size of numbers you will be working with. You have not stated the upper limit of the power of 2 you are working with, but if you use, for example, 2 ^ 65536, this will give you a number of 2.x...e+19728 (try this with calculator using 2 x^y 65536). That means that the decimal number to represent this value will have 19729 digits. This number in binary will have 65536 bits, or 8192 bytes, or 2048 unsigned integers.
Setting the value of a power of 2 is trivial. Start by defining an array of unsigned integers which can contain the largest binary number you expect (plus several more - I'll explain later). Do not try to create 2 ^ 100 by multiplying 2 by 2 100 times, use math. A power of 2 in binary is nothing but a single bit positioned in the binary number, starting with the least significant bit for 2 ^ 0, the next most significant bit for 2 ^ 1, etc. To multiply two powers of 2, just add their exponents, e.g. (2 ^ 10) * (2 ^ 15) = 2 ^ 25. To express the binary value of a power of 2, start by zeroing the array of unsigned integers, then divide the power of 2 by 32, and also save the remainder (the mod 32). Set an unsigned integer to a value of 1, then left shift it by the modulo value (0 to 31 places), then save it in the array at the index of the quotient of the division.
As can be seen from the above, it is trivial to create such a binary value, but now, how to express it as a decimal value so you can scan the result for a string of "777" (remember the bit about how big this string could get). Also take into account array indexing - are you indexing from 0 to n-1 or indexing from 1 to n.
To convert this number to decimal, start from the top end of the array (the most significant end) which should contain a couple of zero values at the top. The reason for these extra zero values is that the division process will not use up each unsigned integer, and the remainder creeps up. When dividing a binary number by a binary number, the number of bits of the resulting quotient will equal the difference between the number of bits in the dividend less the number of bits in the divisor. We will divide this huge binary number (thousands of unsigned integers) by a large unsigned integer, namely 10 ^ 9 (the largest power of 10 that will fit in an unsigned integer).
This will result in a quotient that is one unsigned integer less than the dividend, and a remainder that is less than 10 ^ 9. Save this remainder in another array of unsigned integers. Repeat the process, dividing the new quotient by 10 ^ 9 to create a shorter quotient and a new remainder, saving the remainders in the new array. Continue this process until the resultant quotient is 0 and the last remainder has been saved. Remember the bit about 19729 digits, well, 19729 / 9 = 2192 so the remainder array will have to be at least that long.
Now to create the decimal number. Access each of the saved remainders, starting with the first one saved. This remainder contains the least significant 9 digits of the decimal number, so you will start saving the decimal number in reverse, starting at character (count of remainders * 9). Actually, save a terminating null character 1 character past that, then start the conversion. Divide the remainder 9 times by a value of 10, saving the quotient for each division, and using the remainder for each division to access a decimal character in a string of "0123456789". Save each character in the target decimal string, each character in front of the last saved character (the first in front of the terminating null). Repeat the process for each of the remainders. There will potentially be leading zero characters at the head of the string which can be ignored for your pattern search application (skip by the leading zeros if you intend to print out this string, but remember that 19728 characters takes 247 lines of 80 characters to print - probably not what you want to do).
I'm not sure what your coding looks like and whether or not you can escape to assembly to do the division calculation, but escaping to assembly sure will speed up the entire process rather than trying to cast a moving indexed value as a unsigned long integer. I can help with this if using assembly is possible. Note: I know C, some C++, but really am a MASM coder.
Dave.
|
|
|
|
|
can some body give me the soln ?
|
|
|
|
|
hi i have a bluetooth dongle and a program to serach all the devices using bluetooth,
but the problem is findFirstDevice() function always returns null so it fails in searching but, i know that micrososft will support only a few dongles, mine is broadcom bcm2045a, but is there any alternative than this i came to know that we can use serial communication, but i have a doubt that by using serial com can we able to discover the devices and also can we able to connect to specified device... and if u have any code and tutorials related to this topic plz provide me the link...
|
|
|
|
|
i've never done programming using bluetooth before...
but i suggest you ro google about mobile phone programming...
find beeter API may be...
try this : "http://mobile.liveshere.net/articles/viewarticle.php?id=19"
|
|
|
|
|
Hi all,
i run my application after sum time its stop working and generate a message.
Label of message is "Microsoft windows"
message ::"Application file has stop working"
"Window can check online for a solution of the problem"
three options are available in message window.
"1. check online for a solution and close program"
"2. close the program"
"3. Debug the program"
please tell me how can i solve this.
thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Click on debug to see exactly the cause of the error. This will take you deep inside the MFC code; Additionally, view the call stack to find out the line that directly/indirectly caused this error!
Regards,
Rane
|
|
|
|
|
"_$h@nky_" wrote: i run my application after sum time its stop working and generate a message.
Label of message is "Microsoft windows"
message ::"Application file has stop working"
"Window can check online for a solution of the problem"
Well, your application have crashed and windows reports in a polite manner.
"_$h@nky_" wrote: please tell me how can i solve this.
You could run the application under a debugger and can catch the issue.
Reagrds,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi all,
i m created a SDI type application on WindowsXP.when i run my application on Vista when User Account Control(UAC) is enabled than it gives an error::"External component has thrown an exception".
please tell me what can i do for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Debugging would be a good idea. Analysing the log file of your application (if it does logging) is another thing that I can think of.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
I guess one of the admins deleted my question about advanced debugging and I have no idea why? Can the admin that deleted the question explain to me why he/she did it?
Regards,
Marko Kukovec
Rostfrei
|
|
|
|
|
no such thing happen, except if it was abusive, or at the wrong place (wrong forum)...
|
|
|
|
|
|
I have no idea how did you find it. I was searching for it from the page 1 to page 10 and I guess I missed it. I apologize for wrong accusation.
Regards,
Marko Kukovec
Rostfrei
|
|
|
|
|
Maybe you couldn't find the thread since the thread starter (you?) is "MeNot", and then you replies as "Rostfrei"
Just a thought.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I will be more cautious next time. I posted the question from coworkers computer and continue replying from mine.
Rostfrei
|
|
|
|
|
Rostfrei wrote: I was searching for it from the page 1 to page 10 and I guess I missed it.
No way. As of now, it is in the 5th page. I am not sure if you surfed through all the 10 pages from the beginning.
Rostfrei wrote: I apologize for wrong accusation.
Don't worry, such things do happen. Just exercise more caution in the future, that should help.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|