> Unfortunately, long/float comparison doesn't work quite correctly right now: > > >>> n = 1 > >>> for i in range(2000): n += n > >>> n == 0.0 > OverflowError: long int too large to convert to float > > One strategy for solving the problem is to observe that for every > floating-point implementation, there is a number N with the property that if > x >= N, converting x from float to long preserves information, and if x <= > N, converting x from long to float preserves information. Therefore, > instead of unconditionally converting to float, the conversion's direction > should be based on the value of one of the comparands. > > Of course, such comparisons can be made faster by doing a rough range check > first, and doing the actual conversion only if the number of bits in the > long is commensurate with the exponent of the float. Do you think you can come up with a patch, or at least a description of an algorithm that someone without a wizard level understanding of the issues could implement? --Guido van Rossum (home page: http://www.python.org/~guido/)
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