SQL ASINH function
Returns the inverse hyperbolic sine: ASINH(0) is 0 and ASINH is defined for all real inputs, no domain restriction.
- カテゴリ
- Math
- Returns
float / double- In this category
- 44 of 82
構文
ASINH(number)
エンジンサポート
| エンジン | Support | メモ |
|---|---|---|
| SQL Server | Not built in | No hyperbolic functions; use LN(x + SQRT(x * x + 1)) |
| PostgreSQL | はい | Built in since PostgreSQL 12 |
| MySQL | Not built in | No inverse hyperbolic functions; use the LN identity |
| SQLite | はい | Built in on 3.35+ |
| Oracle | Not built in | No ASINH; use LN(x + SQRT(x * x + 1)) |
例
PostgreSQL
SELECT ASINH(0) AS zero, ASINH(2) AS two; -- 0, 1.4436354751788103
SQL Server
SELECT LOG(2 + SQRT(POWER(2.0, 2) + 1)) AS asinh_two; -- 1.4436354751788103
PostgreSQL
SELECT ASINH(x) AS inv_sinh FROM measurements;
知っておくと便利なこと
- No domain limits: unlike ASIN or ACOS, ASINH accepts any real number and never returns a domain NULL or error.
- The log formula LN(x + SQRT(x * x + 1)) reproduces it, but for large negative x the sum cancels to almost 0 and loses precision. Use -LN(-x + SQRT(x * x + 1)) for negative x, or the built-in.
- Odd function: ASINH(-x) = -ASINH(x), so sign handling comes free.
Questions about ASINH
Which engines have ASINH?
PostgreSQL 12+ and SQLite 3.35+. SQL Server, MySQL and Oracle do not; the identity LN(x + SQRT(x*x + 1)) is the replacement (LOG on SQL Server).
Does ASINH have a domain error like ASIN?
No. ASIN accepts only [-1, 1]; ASINH accepts every real number, negative included, and returns a value with the same sign.
Why does the log formula give a slightly different answer?
LN and SQRT are separate float operations, so the composed result can drift in the last digits versus the engine's purpose-built ASINH. Prefer the built-in.
Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.
Related on SQLly
Cheat sheets for the engines that have it: PostgreSQL, SQLite.
Functions your engine actually has
SQLly's completion lists the built-in functions of the engine you're connected to, whether that's SQL Server, PostgreSQL, MySQL, SQLite or Oracle. Hover a function for help, and signature hints show each argument as you type.