06-23-2015 08:08 AM
Hello,
I'm haveing 3 problems and I would be greatful if someone can help. I've attached
1) I need to calculate 982451653^15. I've used 'Power of X' function but the resut I'm getting is incorrect.
is there a way for getting correct result??
2) after that I need to calculate modulo from result but I get nothing? I'm using 'Quotient & Reminder' function
3) I need to transform number 982451653 to HEX --> 3A8F05C5 and send to array gruped by two from behind as shown below:
3A8F05C5 --> [3A][8F][05][C5] and write it down to array from behind.
Array should be:
...and for hex number 3A8F05C56 --> [03][A8][F0][5C][56]
Array:
Please help!
Solved! Go to Solution.
06-23-2015 08:26 AM
06-23-2015 08:48 AM
Hi SuperBrainBug,
1. Use any of those BigNumber calculation packages - as already suggested and linked by Taki.
2. Use any of those BigNumber calculation packages - as already suggested and linked by Taki.
3. Split your string on groups of 2 chars beginning from the end of the string! But than again: Use any of those BigNumber calculation packages - as already suggested and linked by Taki.
06-23-2015 09:43 AM - edited 06-23-2015 10:01 AM
Hi,
As Taki and Gerd said it seems that you are exceeding the data type capacity with your operation and that you need to use special large number functions for this one.
Just curious... How did you get the correct result?
Im using tools from Windows and I have been unable to get the complete number you posted (same problem that in Labview)
06-24-2015 04:57 AM
Hi, thanks for help 🙂
I'll try what Gerd said and see what I can do and report results.
I've used online calculators for big numbers:
https://defuse.ca/big-number-calculator.htm
and
http://www.javascripter.net/math/calculators/100digitbigintcalculator.htm
06-24-2015 05:39 AM
06-24-2015 05:45 AM
Actually this is first time that I need to calculate something with big numbers, the online application is only for result checking. The headache is to get correct result in labview... I've red your post where you explained how to deal with large numbers and naow I'm trying to do that...
06-24-2015 07:30 AM
I got nothing...
Does anyone has some example how to do this bing number calculation?
06-24-2015 07:38 AM - edited 06-24-2015 07:46 AM
Hi Superbrain,
simple example for a multiplication:
Suppose two numbers A and B, both initialized to hold 64bits of information. You only have a 32bit multiplication available.
Then you can do it like this:
A1 = low_word(A) % lower 32 bits A2 = high_word(A) % higher 32 bits B1 = low_word(B) % lower 32 bits B2 = high_word(B) % higher 32 bits C1 = A1 * B1 C2 = A1 * B2 C3 = A2 * B1 C_4 = A2 * B2 result = C_4 * 2^64 + (C3+C2) * 2^32 + C1
Just an example for a simple multiplication.
Or you could search for ready-to-use BigNumber implementations and use them…
Edit: WTF! Why can we don't write a C followed by a 4 without being interrupted by some misguided spell checker?
06-24-2015 07:52 AM
Dear SuperBrainBug (does that mean you have a Super Brain, or that your Brain has a Super Bug, I wonder),
If you did a little research (or gave a little thought) to "How can I do arithmetic with integers of unspecified size", you would realize that you learned how to do this (or should have learned how to do this) in Elementary School. Suppose I gave you pencil and paper and asked you to calculate 982451653^15. You would multiply 982451652 * 982451652 and would get an 18-digit result. Then you'd multiply again, and again, and many pieces of paper (and hours) later, you would have the result.
How did you do this? You learned an algorithm by which a number (982451653) could be represented as an array of single digits, and multiplication of these two "arrays" could be carried out by knowing how to multiply two single digits, getting the result as a single digit + a "carry" that was used in a subsequent step in the algorithm (along with another operation called "addition").
Use the same algorithm that you learned so long ago and apply it to this problem. Note that it might be efficient to represent your numbers not in Base 10 (where each digit "stands alone" in the array) but in Base 1,000,000,000 -- the steps will be the same, there will just be many fewer of them. The consideration of what Base to use is two-fold -- you must be able to represent your "digits" in this Base (so, for example, it should fit in an I32 digit) and you need to be able to represent the product of two such numbers (so your product also needs a representation -- you might need to use I64 for carrying out the arithmetic).
The algorithm isn't difficult (my 7-year-olds learned it in a few days) and it should prove to be a useful exercise in developing some interesting LabVIEW VIs.
Bob Schor