


Anyone help with this as it's pickling my brain trying to work it out.....??
TIA...

This brings back some scary memories of all the things about maths and computers that I grew to detest!robin wrote:I am assuming you have the algorithm and you just want to implement it?
You really just need C, not C++ (i.e. you can stick to understanding the basic control flow and statements; you don't really need to understand the class/object system that C++ layers on top of C).
Numerical methods is a bit of a specialist subject in programming circles - in particular the standard implementation of single and double precision floating point can be insufficiently accurate around the boundary condition to yield consistent results.
For very long number computations you can use an arbitrary precision "big number" library.
Soooo, how accurately do you want to know the answer? If you just want it to 10 or so decimal places, the standard double precision floating point type will be fine for all but the most bizarre algorithms for computing PI. For greater than 10 d.p. you should start thinking about using arbitrary length libraries. These are about 100 times slower than the CPU's built in floating point processor, but who cares in this case.
In the real world of real programs that do important things, almost nobody uses floating point arithmetic - it's just too woolly
If you really want to learn, I would be happy to explain over a bottle of red wine and a laptop
Cheers,
Robin
Red wine and laptop does sound appealing. I'm struggling with this. Don't have any experience with programming and frankly don't know where to start. pm sent.robin wrote:I am assuming you have the algorithm and you just want to implement it?
You really just need C, not C++ (i.e. you can stick to understanding the basic control flow and statements; you don't really need to understand the class/object system that C++ layers on top of C).
Numerical methods is a bit of a specialist subject in programming circles - in particular the standard implementation of single and double precision floating point can be insufficiently accurate around the boundary condition to yield consistent results.
For very long number computations you can use an arbitrary precision "big number" library.
Soooo, how accurately do you want to know the answer? If you just want it to 10 or so decimal places, the standard double precision floating point type will be fine for all but the most bizarre algorithms for computing PI. For greater than 10 d.p. you should start thinking about using arbitrary length libraries. These are about 100 times slower than the CPU's built in floating point processor, but who cares in this case.
In the real world of real programs that do important things, almost nobody uses floating point arithmetic - it's just too woolly
If you really want to learn, I would be happy to explain over a bottle of red wine and a laptop
Cheers,
Robin