3 ms·
Right, yes, for continued fractions / convergent series, floats are almost certainly going to be a complete disaster whereas if only integer division is involve
by raiph 5y ago
Right, yes, for continued fractions / convergent series, floats are almost certainly going to be a complete disaster whereas if only integer division is involved, as is the case with this series, then arbitrary precision rationals are going to be exact, and often sufficiently performant for most such series for results up to about 15 decimal digits or so.
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 https://www.youtube.com/watch?v=Nq2HkAYbG5o#t=11m09s
- self_buddliea 5y agoThank you for the link, I might start watching at the beginning.
- 7thaccount 5y agoIt really is a great presentation. I sent Damian an email after watching it and he was also extremely approachable and took the time to answer my questions and talk about the future of raku (at that time Perl 6).