On Mon, Feb 6, 2017 at 11:29 AM, M.-A. Lemburg <m...@egenix.com> wrote:
> > Juraj: Could you provide some use cases, where such a function > would help in Python applications ? (I can see use cases > written in C, but due to the low level, find it hard to > believe that people would use this at the Python level) > In my case, `nextafter` would be used to check if a number is close to polynomial zero, e.g.: def f(x): return 2.0*x**3 - 3.0*x**2 + 5.0*x - 7.0 # x = 1.4455284586795218 x = 1.445528458679522 # x = 1.4455284586795223 # x = 1.4455284586795225 left = nextafter(x, -float('inf')) right = nextafter(x, float('inf')) print((f(left) < 0.0) != (f(x) < 0.0) or (f(x) < 0.0) != (f(right) < 0.0))
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/