I'm using Aparapi to do number crunching inside my Java program on the GPU. From what I understand, Aparapi plays nice with float arrays.
I want to compute Pi to the Nth decimal using Aparapi. I'm thinking of using the Leibniz method, but I'm not sure how I would deal with representing and storing the long decimals in float or integer form.
Would an array of integers work, with the size of the array being the N number of decimals wanted?
int[] digits = new int[N];
If I were to use this with the Leibniz method, I would need to calculate an array of N integers for M terms I find (Liebniz says pi/4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 ....), and then add those together and multiply the resulting number by 4. But this would mean I'd need to allocate M many integers for EACH term I computed, which would add up and really take a toll on memory.
tl;dr: How can I calculate Pi using loops of float operations so I can do it with Aparapi?
Thanks a bunch!