I think you need to start by taking each individual Sub and writing a test for it, to make sure it does what you expect.

I tried with arraymulty(), but it seems to have a dependency on the 'numdigits' global variable, and with a default value of 0 the sub doesn't do anything.In the program as written, numdigits only gets set if you call it through findpi().

I adapted a similar program found in a magazine eons ago, I hope you won't mind me posting it, who knows, it may give you some insight.did your code work before you replaced the integer array with string? if so then please post that code as it would help to diagnose the problem

It looks like arraymulty() is multiplies the decimal portion of a number by m/10, to 'numdigits+1' decimal places.(e.g. multy("0123", 2) with numdigits=5 gives "002460", like 0.0123 * 2/10 = 0.00246[0...])

But arrayadd() and arraysub() just seem to add/subtract two integer strings.

My math skills are a bit too rusty to easily determine how arctangent() and findpi() work..

The code by bluatigro is based on strings and works on one digit at the time. This not very effective and slow.So I have created a program to use uinteger array's, making it possible to process 9 digits at the same time.The calculations are all done as unsigned integers what help to speed up things.Works with FB 32 bit, works even slightly faster in 64 bit version.

' array(0) = lsb, array(l1) = msb.' using UInteger<32> array's (32 bit), result in UInteger<64> (64 bit).' very little errror checking.' the multiply routine ignores the last carry (= 3).' the routine's work only for positive numbers.' replaced all [U]Integer with [U]Integer<32> and all UlongInt with Uinteger<64>

Checking every subroutine for returning the correct result was in this case the easiest option since all the routine's are small and easy to understand what the result should be.The for next loop should be from 1 to numdigits or from numdigits to 1 step -1 and not taking the length of the input strings.Testing the array[mult|div|add] showed that they returned the correct results.The arraysub routine returned the wrong answer, while checking I noticed that b was set (b = int( h / 10 )) but it result wasn't used, after some pen and paper work that showed that (7 - 5 + 10 = 12) results in b = 1 and (5 - 7 + 10 = 8) results in b = 0, in case of b = 0 we need to borrow 1 from the digit left of the digit we work on.Ex. if b = 0 then inuit[p -1 -1]= inuit[p -1 -1] -1, what can go wrong if inuit[p -1 -1] = 0 then we get a negative numberAfter some tinkering and checking I found that b = 1 - Int( h / 10 ) would do the trick. b = 0 when there's no need for a borrow and b = 1 if we need to borrow.Arrayzero is straight forward returning a 1 if there are only 0's (zero's) in input stringRunning the program still gave the wrong answer.Starting checking arctangent the first I noticed was that formula give for arctan was wrong, inserting the correct formula and checking the routine with the correct formula showed that routune was correct.The only odd thing was that s was divived with i and later multiplied with i to get the "original" value back, the whole do loop could be optimized with out this, and be more precise. Doing some printing of the variables while running the program revealed that the first time arctanget is called, t and s are empty resulting in s being 1 instead of being 1000...000, the second time t has a value and s contains only 0's.Changing the way s is set by "1" + String(numdigits -1, "0") and running gave the result "3.31415...", so the returning string had to be reformatted as well.

Some remark.The x = Int( y / 10 ) should be changed in x = y \ 10, integer division (\) instead of the floating point division (\) Changes numdigits = digits +2 into digits +5 in some occasions +2 was not enoughStrings aren't the best way for doing calculations because the conversion that has to be done (Str <> Val),a array of [U]byte's would be better or accesesing the string by index (string[index]).The arctangent routine should be rewritten to get rid off the multiplying of s by i, also repeating w = d * d in the loop is not very effective. String z10 and z100 will work but it would be better to replace them with string(x, "0")In the arrayadd and arraysub the inout string is always bigger then [ad|sb] string, therefore padding the inout string is not needed

In the first conversion I did things a little different, I had trouble with the 0's in front of the numbers, in the above version it doesn't matter if there are 0's in front of the numbers.

I also made some small changes in the 2 programs I posted earlier in this thread.