I want to do a very simple calculation, but with maximum precision.
What I am talking about is what I think called... well I really have no idea what it's called in english, but it doesn't matter, heres an example:
(1- 1/2)(1 - 1/3)(1 - 1/5)(1 - 1/7)...
or
(1 - 1/p1)(1 - 1/p2)(1 - 1/p3)(1 - 1/p4)...
As you see primes is the key element here, but that is not my problem, i've allready written a fairly inginious prime class
The problem, of course, is that if i do the above calculation straight forward, I will soon run in to some serious precision issues, so instead i want to do it like this:
Code: Select all
p1-1 p2-1 p3-1 p4-1
---- * ---- * ---- * ---- ...
p1 p2 p3 p4
Code: Select all
1 2 4 6
- * - * - * - ...
2 3 5 7
Code: Select all
1 2/2 4 6/3
--- * --- * - * --- ...
2/2 3/3 5 7
Code: Select all
1 1 4 2
- * - * - * - ...
1 1 5 7
I have tryed to figure out a smart way to im pliment all this, but I'm simply not experienced enough, so I was hoping that someone would give it a try.
Nb.
This is not something important, the result isn't very important and the reason I started this little experiment was really only for the sake of the experiment, so if nobody other than me finds it of interested, then be it.
Thanks anyway for reading