Leave sign of 0 unspecified for tanh `inf + yj`

Open Beginner friendly
#1,006 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Domain
documentation

Research direction

Start at the tanh complex special-cases section linked in the issue and compare its +infinity + iy wording with the cited ctanh specification. Update the requirement so it does not mandate a positive signed zero, then verify that the array API special-case tests and the dpnp failure are consistent with the revised wording.

Written by the indexing model from the issue text.

Description

The array API spec states, for tanh complex special cases

If a is +infinity and b is a positive (i.e., greater than 0) finite number, the result is 1 + 0j

from open-std pages describing ctanh

— ctanh(+∞ + iy) returns 1 + i0sin(2y), for positive-signed finite y.

This matches up to the math (we can derive this from tanh(x + iy) taking the limit as x approaches infinity and constraining y to be finite), and gives us 1 ± 0i, with the sign being inherited from sin(2y) if we care about signed zeros, rather than positive zero in all cases.

This was brought up because this special case is tested by the array API tests, which causes dpnp to fail the test.

Dominant language
Python
Stars
281
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from data-apis/array-api

All issues in data-apis/array-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.