Skip to content

Adding hyperbolic trigonometric functions #13346

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

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

nickgerrets
Copy link
Contributor

This PR adds the hyperbolic trigonometric functions of:

  • cosh
  • sinh
  • tanh
  • acosh
  • asinh
  • atanh

atanh will throw an exception if input is out of bounds [-1,1] and will return inf if the input is precisely -1 or 1.

@Mytherin Mytherin merged commit 50bb607 into duckdb:main Aug 8, 2024
37 checks passed
@Mytherin
Copy link
Collaborator

Mytherin commented Aug 8, 2024

Thanks!

@carlopi
Copy link
Contributor

carlopi commented Aug 8, 2024

Minor question: atanh gets custom handling to address out-of-range values, should the same be there for acosh? Currently it returns NaNs when out of bounds, while I would think a Invalid Input Error: ACOSH is undefined outside [1,inf] would be more similar to the rest.

github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Aug 8, 2024
Merge pull request duckdb/duckdb#13346 from nickgerrets/hyperbolic_trigonometry
Mytherin added a commit that referenced this pull request Oct 22, 2024
#13346 added `acosh` along with other hyperbolic trigonometric
functions. The current `acosh` example uses a value that falls outside
of the function's domain. In Postgres, this returns and error, while in
DuckDB it returns a NaN:

```sql
postgres=# select acosh(0.5);
ERROR:  input is out of range
```

```sql
D select acosh(0.5);
┌────────────┐
│ acosh(0.5) │
│   double   │
├────────────┤
│        nan │
└────────────┘
```

This PR changes the example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants