Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94906: Support multiple steps in math.nextafter #94908

Closed
wants to merge 3 commits into from

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Jul 16, 2022

@@ -3802,7 +3805,14 @@ math_nextafter_impl(PyObject *module, double x, double y)
return PyFloat_FromDouble(y);
}
#endif
return PyFloat_FromDouble(nextafter(x, y));
if (steps < 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can allow zero steps just fine.

PyErr_SetString(PyExc_ValueError, "steps must be >= 1");
return NULL;
}
for (i = 0; i < steps; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can support this without a loop. See this pure Python prototype for how that can work.

@hauntsaninja
Copy link
Contributor Author

Closing since Matthias' no loop suggestion is appealing, there isn't much movement on the issue and I have a merge conflict :-)

@hauntsaninja hauntsaninja deleted the gh-94906 branch December 12, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants