On 7/4/2018 2:32 PM, Sven R. Kunze wrote: > Sorry for adding yet another mail. :-( > > On 04.07.2018 10:54, Serhiy Storchaka wrote: >> Sorry, this PEP was rewritten so many times that I missed your Appendix. >> >>> while total != (total := total + term): >>> term *= mx2 / (i*(i+1)) >>> i += 2 >>> return total >> > > This very example here caught my eye. > > Isn't total not always equal to total Repeat response given elsewhere. No. Python has limited precision floats, not reals. Floats do not obey laws of real numbers. >>> 1e50 + 1e34 == 1e50 True >>> 1e50 + 1e35 == 1e50 False Basic numerical analysis operation: approximate infinite sum of decreasing terms by summing terms until they become small enough that they can be ignored. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4