04-25-2010 09:48 AM
Hello!
I got a task for which I want to work with integer numbers that contain 60 or more decimal digit. But the standard operators(+,-,/,*) do not allow it to do. Is there a simple way to solve this problem? Maybe math scripts? I use Labview 2009.
Thanks, 73s!
04-25-2010 11:35 AM
04-26-2010 09:57 AM
04-26-2010 11:00 AM
04-29-2010 02:50 AM
04-29-2010 03:03 AM - edited 04-29-2010 03:06 AM
Hi nh,
have you ever done kind of operations like this?
You want to calculate a number needing 71bits of precision.
In your code you either use an I64 providing 63 bits precision or DBL providing 53 bits. That simply isn't enough to hold 71 bits of information! Then you wonder why you can't subtract 1 from those results...
My suggestion is to split (integer) numbers in several powers of 2. (You could split for other base numbers too. Simply adapt your math routines.)
Suppose an example, where you only handle 4 bits per memory location.
You could split a number like 1000 (decimal) into 4bit-portions:
1000d = 11'1110'1000b = 3 * 2^8 + 14 * 2^4 + 8 * 2^0.
Now you can do calculations like this:
A + B = a*2^8 + a*2^4 + a*2^0 + b*2^8 + b*2^4 + b*2^0 = (a+b)*2^8 + (a+b)*2^4 + (a+b)*2^0 (using a carry from lowest to highest power term).
Or you use one of the available software packages, that have all those mathematics already working and tested
04-29-2010 05:39 AM - edited 04-29-2010 05:42 AM
04-29-2010 05:46 AM
04-29-2010 06:01 AM
GerdW wrote:Now you can do calculations like this:
A + B = a*2^8 + a*2^4 + a*2^0 + b*2^8 + b*2^4 + b*2^0 = (a+b)*2^8 + (a+b)*2^4 + (a+b)*2^0 (using a carry from lowest to highest power term).
I decompose on the amount too.I believe you, and wiki too)))
04-29-2010 06:04 AM - edited 04-29-2010 06:06 AM
Hi nh,
in your example you're calculating with DBLs which are shown in I64 indicators - and trying to work with >70bit precision.
I don't see any decomposition...
Btw. did you notice all those red coercion dots? Do you know what they are for?