Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Let math.nextafter() compute multiple steps at a time. #94906

Closed
Labels
3.12only security fixestype-featureA feature request or enhancement
@rhettinger

Description

@rhettinger

Sometimesmath.nextafter() needs to be applied multiple times in succession.

   x = nextafter(nextafter( nextafter(x, inf), inf), inf)    # Three steps up

It would be nice if the function supported this directly:

   x = nextafter(x, inf, n=3)

The implementation would just be a for-loop:

def newnextafter(x, y, /, *, n=1):    'Return the floating-point value n steps after x towards y.'    for i in range(n):        x = nextafter(x, y)    return x

The formal paramater can be justn or the longer but more descriptivesteps.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixestype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp