Skip to content

cmath.tanh(±0+infj) and tanh(±0+nanj) should return ±0+nanj #122637

Closed

Description

@skirpichev

Bug report

Bug description:

As per C11 DR#471 (accepted for C17), ctanh (0 + i NaN) and ctanh (0 + i Inf) should return 0 + i NaN (with "invalid" exception in the second case). Currently, real part is nan.

This has corresponding implications for ctan(z), as its errors and special cases are handled as if the operation is implemented by -i*ctanh(i*z).

See glibc patch: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d15e83c5f5231d971472b5ffc9219d54056ca0f1

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. added a commit that references this issue on Aug 3, 2024
  2. skirpichev commented on Aug 3, 2024

    @skirpichev
    MemberAuthor

    PR is ready for review: #122638

    See also #121889

  3. added a commit that references this issue on Aug 4, 2024
  4. mdickinson commented on Aug 4, 2024

    @mdickinson
    Member

    Closed in #122638, with thanks to @skirpichev. As with #121889, I don't think this is behaviour that should be changed in a bugfix release, so it's not a candidate for backport.

  5. skirpichev commented on Aug 4, 2024

    @skirpichev
    MemberAuthor

    Great. Now glibc's libm pass cmath_testcases.txt.

    One minor note, now we have slightly misleading comment:

    /* First, the C functions that do the real work. Each of the c_*
    functions computes and returns the C99 Annex G recommended result

    This (and fix for #121889) is available in C17, not C11C99. Though, as you can see, glibc turns this on unconditionally.

    Probably, we should adjust comment.

    PS: And now this really closed.

  6. added a commit that references this issue on Aug 7, 2024
  7. added a commit that references this issue on Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions