|
|
|
|
|
by self_buddliea
1806 days ago
|
|
I'm referring to the float registers, not arbitrary precision. So, 'math.pi' essentially. You probably already know this, I'll apologise in advance - My understanding is you can only get accurate values of a value smaller than unity on a float if it is a sum of perfect powers of 1/2 (ie. the denominator is a perfect power of two). Therefore any reciprocal of an odd number will get an error (bar the first term, which is 1) since odd numbers don't fall into the above category (except for 1). I tried using this series years ago to calculate pi. It was a total disaster, the final value was way off. Edit: 'sum of' |
|
Damian demonstrates this difference between using floats and arbitrary precision rationals when he shows code for computing Bernoulli numbers in his "On The Shoulders Of Giants" presentation.[0]
(Btw, if you care about programming and appreciate a combination of total technical and geek mastery with standup comic delivery, the whole thing is like watching a great movie, whether you watch it from the "start" at the 5 minute mark, or skip forward to the 45 minute mark for the 15 minute Quantum Computing For Beginners section.)
[0] https://www.youtube.com/watch?v=Nq2HkAYbG5o#t=11m09s