C Math sinh() Function

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
<math.h>

What You’ll Learn

The sinh() function computes the hyperbolic sine of a real number. Built from exponentials—(ex − e−x) / 2—it passes through zero at x = 0 and grows without bound as |x| increases.

01

Hyperbolic

Not circular.

02

math.h

Link with -lm.

03

Any real x

Full domain.

04

sinh(0)=0

Through origin.

05

Odd fn

sinh(−x).

06

vs sin

Different.

Definition and Usage

Hyperbolic sine is defined as sinh(x) = (ex − e−x) / 2, where e is Euler’s number (about 2.718). Unlike circular sin(), which oscillates between −1 and 1, sinh(x) grows smoothly and is unbounded.

The input x is any real number—not a degree or radian angle in the circular sense. Think of it as a hyperbolic parameter. At x = 0, both exponentials cancel and sinh(0) = 0.

💡
Beginner Tip

Do not confuse sinh() with sin(). sin needs radians and returns values in [−1, 1]. sinh takes any real number and grows without limit. The inverse is asinh() for all real outputs.

📝 Syntax

Standard C declaration:

C
double sinh(double x);

Related variants

C
float sinhf(float x);             /* <math.h> */
long double sinhl(long double x); /* <math.h> */

Parameters

  • x — any real number (hyperbolic argument).

Return Value

  • Hyperbolic sine of x as double.
  • sinh(0) returns 0.0.
  • sinh(1.5) returns about 2.129.
  • For very large |x|, result may overflow to ±infinity.

Headers and linking

  • #include <math.h>
  • Compile: gcc sinh.c -std=c11 -o sinh -lm

⚡ Quick Reference

CallMeaningResult (approx.)
sinh(0)Origin0.0
sinh(1)Standard value1.175
sinh(1.5)From reference2.129
sinh(-1.5)Odd function-2.129
asinh(sinh(x))Inverse pairx
Forward
sinh(x)

Hyperbolic sin

Inverse
asinh(y)

All real y

Formula
(exp(x)-exp(-x))/2

Exponential

Not this
sin(x)

Circular trig

Examples Gallery

Compile every example with gcc file.c -std=c11 -o out -lm. Hyperbolic functions pair naturally with exp() and cosh().

📚 Getting Started

Compute hyperbolic sine and print the result.

Example 1 — Basic Hyperbolic Sine

Classic example from the reference: sinh(1.5).

C
#include <math.h>
#include <stdio.h>

int main(void) {
    double x = 1.5;
    double result = sinh(x);

    printf("The hyperbolic sine of %.2f is: %.4f\n", x, result);

    return 0;
}

How It Works

The library evaluates (e1.5 − e−1.5) / 2 internally and returns about 2.129.

Example 2 — sinh(0) Equals 0

Hyperbolic sine passes through the origin.

C
#include <math.h>
#include <stdio.h>

int main(void) {
    printf("sinh(0) = %.1f\n", sinh(0.0));

    return 0;
}

How It Works

When x = 0, e0 = 1, so sinh(0) = (1 − 1) / 2 = 0. Both sinh and circular sin are zero here—but only here at x = 0 do they share that value by coincidence.

📈 Practical Patterns

Symmetry, exponential formula, and comparison with sin.

Example 3 — Odd Function: sinh(−x) = −sinh(x)

Negative inputs flip the sign—unlike cosh, which is even.

C
#include <math.h>
#include <stdio.h>

int main(void) {
    double x = 1.5;

    printf("sinh( %.1f) = %.6f\n",  x, sinh(x));
    printf("sinh(%.1f) = %.6f\n", -x, sinh(-x));

    return 0;
}

How It Works

Swapping the sign of x swaps the sign of the result. This mirrors circular sin, which is also an odd function.

Example 4 — Verify with the Exponential Formula

Compute sinh(x) manually using exp() and compare.

C
#include <math.h>
#include <stdio.h>

int main(void) {
    double x = 2.0;
    double manual = (exp(x) - exp(-x)) / 2.0;
    double library = sinh(x);

    printf("x = %.1f\n", x);
    printf("Manual:   %.6f\n", manual);
    printf("sinh():   %.6f\n", library);

    return 0;
}

How It Works

The manual formula matches the library. In production code, prefer sinh()—it handles overflow and precision better than naive exp combinations for extreme values.

Example 5 — sinh() vs sin() at the Same Input

See why these are different functions despite similar names.

C
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>

int main(void) {
    double vals[] = { 0.0, 1.0, 1.5, M_PI / 2 };
    size_t i;

    printf("    x     sinh(x)   sin(x)\n");
    for (i = 0; i < 4; i++) {
        double x = vals[i];
        printf("%5.2f  %8.4f  %8.4f\n", x, sinh(x), sin(x));
    }

    return 0;
}

How It Works

They only agree at x = 0. For other inputs, sinh grows while sin stays in [−1, 1]. Note: 1.57 is π/2 radians (90°) for the last row—sin needs radians; sinh does not.

🚀 Common Use Cases

  • Physics and engineering — solutions to differential equations, heat flow.
  • Special relativity — rapidity and Lorentz transformations use hyperbolic functions.
  • Signal processing — filter design with hyperbolic kernels.
  • Finance — models involving exponential growth and decay.
  • Pair with cosh() — identity cosh²(x) − sinh²(x) = 1.

🧠 How sinh() Works

1

Receive real x

Any finite real number (positive, negative, or zero).

Input
2

Compute exponentials

Evaluate ex and e−x, take half their difference.

Compute
3

Return sinh(x)

Result is a double; unbounded as |x| grows.

Output
=

Hyperbolic sine

Use asinh(y) to reverse for any real y.

📝 Notes

  • Defined as (ex − e−x) / 2.
  • Domain: all real numbers.
  • sinh(0) = 0; output is unbounded as |x| grows.
  • Odd function: sinh(-x) == -sinh(x).
  • Not the same as sin()—no degree/radian conversion needed.
  • Very large |x| may cause overflow; the library handles this gracefully.

⚡ Optimization

sinh() is implemented in the platform math library with careful handling of overflow. Avoid rewriting it as (exp(x) - exp(-x)) / 2 in hot loops—direct exp calls can overflow sooner. Use sinhf when float precision is sufficient to save memory bandwidth.

Conclusion

sinh() computes hyperbolic sine from exponentials, accepts any real input, and passes through zero at x = 0. It is distinct from circular sin() and pairs with asinh() as its inverse.

Continue with sqrt() for square roots, or review cosh() for the partner hyperbolic function.

💡 Best Practices

✅ Do

  • Include <math.h> and link with -lm
  • Use sinh() instead of manual exp formulas
  • Remember sinh(0) = 0
  • Use asinh() to invert hyperbolic sine
  • Pair with cosh() for hyperbolic identities

❌ Don’t

  • Confuse sinh() with sin()
  • Convert degrees/radians before calling sinh()
  • Expect output bounded in [−1, 1] like circular sine
  • Assume the input is an “angle in radians” in the trig sense
  • Rewrite with exp in performance-critical code without profiling

Key Takeaways

Knowledge Unlocked

Five things to remember about sinh()

Hyperbolic sine in C, explained simply.

5
Core concepts
📚 02

sinh(0)=0

Origin.

Anchor
📈 03

Formula

(e^x-e^-x)/2.

Math
📄 04

Odd fn

All reals in.

Property
🔄 05

Inverse

asinh(y).

Pair

❓ Frequently Asked Questions

sinh() returns the hyperbolic sine of x, computed as (e^x - e^(-x)) / 2. For example, sinh(0) is 0.0 and sinh(1.5) is about 2.129. It is not the same as the circular sine function sin().
Include <math.h> and link with -lm on many systems: gcc program.c -o program -lm. The function is declared as double sinh(double x).
Neither in the usual trig sense. sinh(x) takes any real number x as a hyperbolic argument. You do not convert degrees to radians before calling sinh() the way you do for sin().
sin() is circular trigonometry (input in radians, output in [-1, 1]). sinh() is hyperbolic (input is any real, output unbounded). They share a similar name but solve different math problems.
sinh(0) is exactly 0. At zero, (e^0 - e^0) / 2 = (1 - 1) / 2 = 0. This is the only point where sinh and cosh cross their respective anchor values together.
sinhf(x) takes float and returns float. sinhl(x) takes long double and returns long double. Use the variant matching your variable type.
Did you know?

Hyperbolic functions satisfy cosh²(x) − sinh²(x) = 1—the hyperbolic analogue of the Pythagorean identity sin² + cos² = 1. You can verify it in C with cosh(x)*cosh(x) - sinh(x)*sinh(x) for any x.

Explore C Math Functions

Continue with sqrt() or browse the full math function reference.

Math Functions Index →

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.

5 people found this page helpful