<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 6, 2017 at 11:29 AM, M.-A. Lemburg <span dir="ltr"><<a href="mailto:mal@egenix.com" target="_blank">mal@egenix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Juraj: Could you provide some use cases, where such a function<br>
would help in Python applications ? (I can see use cases<br>
written in C, but due to the low level, find it hard to<br>
believe that people would use this at the Python level)<br></blockquote><div><br></div><div>In my case, `nextafter` would be used to check if a number is close to polynomial zero, e.g.:</div><div><br></div><div> def f(x):</div><div> return 2.0*x**3 - 3.0*x**2 + 5.0*x - 7.0</div><div> </div><div> # x = 1.4455284586795218</div><div> x = 1.445528458679522</div><div> # x = 1.4455284586795223</div><div> # x = 1.4455284586795225</div><div> </div><div> left = nextafter(x, -float('inf'))</div><div> right = nextafter(x, float('inf'))</div><div> </div><div> print((f(left) < 0.0) != (f(x) < 0.0) or (f(x) < 0.0) != (f(right) < 0.0))</div><div> </div></div></div></div>