// math reference

SQL ACOSH function

Returns the inverse hyperbolic cosine for inputs of 1 or more: ACOSH(1) is 0 and ACOSH(COSH(2)) is 2.

Category
Math
Returns
float / double
In this category
45 of 82

Syntax

ACOSH(number)

Engine support

EngineSupportNotes
SQL Server Not built in No hyperbolic functions; use LN(x + SQRT(x * x - 1)) for x >= 1
PostgreSQL Yes Built in since PostgreSQL 12
MySQL Not built in No inverse hyperbolic functions; use the LN identity
SQLite Yes Built in on 3.35+
Oracle Not built in No ACOSH; use LN(x + SQRT(x * x - 1))

Examples

PostgreSQL

SELECT ACOSH(1) AS zero;  -- 0

SQL Server

SELECT LOG(2 + SQRT(POWER(2.0, 2) - 1)) AS acosh_two;  -- about 1.3170

SQLite

SELECT ACOSH(0.5) AS out_of_domain;  -- NULL

Good to know

  • Domain is [1, infinity): ACOSH(0.5) returns NULL on SQLite and raises 'input is out of range' on PostgreSQL.
  • The log formula LN(x + SQRT(x * x - 1)) works for x >= 1; SQRT of a negative number inside it is the same domain error in disguise.
  • ACOSH returns non-negative results only, since COSH is symmetric and the inverse conventionally takes the positive branch.

Questions about ACOSH

Why does ACOSH return NULL or error for 0.5?

COSH never produces values below 1, so the inverse is undefined there. SQLite returns NULL; PostgreSQL raises an out-of-range error.

What is the portable ACOSH formula?

LN(x + SQRT(x * x - 1)), valid for x >= 1. SQL Server spells LN as LOG; MySQL and Oracle use LN directly.

What is ACOSH(1)?

Exactly 0: the only input whose hyperbolic cosine is 1 is zero.

Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.

Cheat sheets for the engines that have it: PostgreSQL, SQLite.

// fewer lookups

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.