Java Math sinh() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Java 5+

Definition

In Java, Math.sinh(x) returns the hyperbolic sine of x, defined as (ex - e-x) / 2. Despite the name, it has nothing to do with angles: x is not in radians or degrees. Math.sinh(0) is 0.0, and Math.sinh(1) is about 1.1752.

The function is zero at 0, odd (sinh(-x) = -sinh(x)), and grows very fast for larger |x|. It appears in physics and engineering, for example in the arc length of a hanging cable, and in some neural-network and signal-processing formulas. It was added in Java 5.

A static method of the java.lang.Math class, added in Java 5 (JDK 1.5). Call it on the class name, as in Math.sinh(...). No import is needed, because classes in java.lang are always visible.

Syntax

Pass any double. The hyperbolic sine comes back as a double.

Java
double a = Math.sinh(0.0);                  // 0.0
double b = Math.sinh(1.0);                  // about 1.1752
double c = Math.sinh(-1.0);                 // about -1.1752
double big = Math.sinh(1000.0);             // Infinity
CallWhat it does
Math.sinh(0.0)Returns 0.0.
Math.sinh(-0.0)Returns -0.0 (zero keeps its sign).
Math.sinh(1.0)About 1.1752.
Math.sinh(1000.0)Too large for a double: returns Infinity.

There is only a double version, and it takes any real number: unlike asin or acos it has no restricted domain. The inverse function (asinh) does not exist in java.lang.Math.

Library declarations
Java
// java.lang.Math
public static double sinh(double x)

Parameters

ParameterDescription
xThe number whose hyperbolic sine is wanted. Not an angle.

Return Value

Return ValueDescription
doubleThe hyperbolic sine of x. The result is NaN if x is NaN, an infinity with the same sign as x if x is infinite (or too large), and a zero with the same sign if x is zero.

Compare with Similar Methods

The hyperbolic trio and the exponential:

MethodHow it differs
cosh(x)Hyperbolic cosine: even, never below 1.
tanh(x)Hyperbolic tangent: sinh / cosh, always between -1 and 1.
exp(x)The building block: sinh(x) = (exp(x) - exp(-x)) / 2.
sin(a)The ordinary (circular) sine, which needs an angle in radians.

Java Examples

Example 1 — Hyperbolic Sine at 0, 1, and -1, and the Infinite Cases

See the odd symmetry, the signed zero, and the overflow for large arguments.

Java
import java.util.Locale;

public class MathSinhBasics {
    public static void main(String[] args) {
        System.out.println("sinh(0.0)  = " + Math.sinh(0.0));
        System.out.println("sinh(-0.0) = " + Math.sinh(-0.0));
        System.out.println("sinh(1.0)  = " + String.format(Locale.US, "%.4f", Math.sinh(1.0)));
        System.out.println("sinh(-1.0) = " + String.format(Locale.US, "%.4f", Math.sinh(-1.0)));
        System.out.println("odd function? " + (Math.abs(Math.sinh(2) + Math.sinh(-2)) < 1e-12));
        System.out.println("sinh(Infinity)  = " + Math.sinh(Double.POSITIVE_INFINITY));
        System.out.println("sinh(-Infinity) = " + Math.sinh(Double.NEGATIVE_INFINITY));
        System.out.println("sinh(1000.0)    = " + Math.sinh(1000.0));
    }
}

How It Works

  1. Zero in, zero out. The curve passes through the origin, and the sign of a zero argument is kept, so -0.0 gives -0.0.
  2. Odd symmetry. The value at -1 is exactly the negative of the value at 1 (1.1752 and -1.1752), and sinh(2) + sinh(-2) cancels to within 1e-12.
  3. Overflow without an error. e1000 is far beyond the largest double (about 1.8E308), so the result is Infinity, as it is for an infinite argument.

Example 2 — sinh vs the exp Formula, and Why Tiny Values Differ

Check that the built-in method matches (e^x - e^-x) / 2, then try a very small x.

Java
import java.util.Locale;

public class MathSinhExp {
    public static void main(String[] args) {
        double x = 0.5;
        double byFormula = (Math.exp(x) - Math.exp(-x)) / 2;
        System.out.println("sinh(0.5) = " + String.format(Locale.US, "%.4f", Math.sinh(x)));
        System.out.println("formula   = " + String.format(Locale.US, "%.4f", byFormula));
        System.out.println("same within 1e-12? " + (Math.abs(Math.sinh(x) - byFormula) < 1e-12));

        double tiny = 1e-10;
        double naive = (Math.exp(tiny) - Math.exp(-tiny)) / 2;
        System.out.println("sinh matches tiny? " + (Math.abs(Math.sinh(tiny) - tiny) < 1e-20));
        System.out.println("formula matches tiny? " + (Math.abs(naive - tiny) < 1e-20));
    }
}

How It Works

  1. Same curve. At x = 0.5 both ways give 0.5211, and they differ by far less than 1e-12, so the method is just a more careful version of the textbook definition.
  2. For tiny x, sinh is almost x. The true value of sinh(1e-10) is 1e-10 plus about 1.7E-31, which equals 1e-10 in a double, so the library result is within 1e-20 of tiny.
  3. Subtraction loses digits. exp(1e-10) is stored as roughly 1.0000000001 with only 16 digits, so subtracting exp(-1e-10) leaves an error near 1E-17, far over 1e-20; the formula fails the test.

Example 3 — Arc Length of a Hanging Cable

A uniform cable that hangs under its own weight forms a catenary. The length of cable from its lowest point to a sideways distance x is a * sinh(x / a). Here the constant a is 50.

Java
import java.util.Locale;

public class MathSinhCable {
    public static void main(String[] args) {
        double a = 50.0;
        int[] sideways = {10, 20, 30, 40};
        for (int x : sideways) {
            double length = a * Math.sinh(x / a);
            System.out.println(String.format(Locale.US, "%2d m sideways -> %.2f m of cable", x, length));
        }
    }
}

How It Works

  1. Divide by the constant. x / a uses double division because a is a double: 10 / 50.0 is 0.2, and sinh(0.2) is about 0.2013.
  2. Close to x when shallow. Near the lowest point the cable is almost flat, so 10 m sideways needs only 10.07 m of cable, barely more than the horizontal distance.
  3. Costs grow quickly. By 40 m sideways the cable has to be 44.41 m long: sinh curves upward faster than a straight line.

Frequently Asked Questions

It returns the hyperbolic sine of a double, defined as (e^x - e^-x) / 2. For example, Math.sinh(1) is about 1.1752.
No. sin works with angles in radians and always returns a value from -1 to 1. sinh is a different, exponential-based function with no upper limit.
Java 5 (JDK 1.5). Older versions have to compute it from Math.exp.
Infinity (or -Infinity for very negative values) once the true result exceeds the largest double, which happens near 710. No exception is thrown.
No. Math.sinh is more accurate, especially for small x, where the hand-written subtraction cancels most of the significant digits.

Next: sqrt()

Square root of a double. Negative input gives NaN.

sqrt() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful