Oracle TANH Function: A Simple Guide

The TANH function in Oracle SQL is a mathematical function that returns the hyperbolic tangent of a number.

This is an exponential function, different from the standard trigonometric TAN (tangent) function. It's often used in physics, engineering, and complex calculations.

What is the TANH Function in Oracle?

The TANH(n) function takes a number n and returns its hyperbolic tangent. The calculation is equivalent to:

(EXP(n) - EXP(-n)) / (EXP(n) + EXP(-n))

Where EXP is e (Euler's number) raised to the power of n. The result is always a value between -1 and 1.

TANH Function Syntax

The syntax for TANH is very simple:

TANH(n)

Let's break that down:

  • n (the number): The number for which you want to find the hyperbolic tangent.

Oracle TANH Function Examples

Here are two practical examples of how to use TANH.

Example 1: Finding the Hyperbolic Tangent of 1

This example calculates the hyperbolic tangent of the number 1.

Query:

SELECT 
  TANH(1) AS "Hyperbolic_Tangent_of_1"
FROM DUAL;

Result:

Hyperbolic_Tangent_of_1
-----------------------
             .761594156

Example 2: Finding the Hyperbolic Tangent of 0

This example calculates the hyperbolic tangent of 0, which is always 0.

Query:

SELECT 
  TANH(0) AS "Hyperbolic_Tangent_of_0"
FROM DUAL;

Result:

Hyperbolic_Tangent_of_0
-----------------------
                      0
Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments