C asin() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
math.h

Definition

In C, asin() returns the angle whose sine is x. The angle is in radians, from -π/2 to π/2. asin(0) is 0, and asin(1) is π/2.

You pass one double. It must be from -1 to 1. The result is a double in radians, not degrees. Include <math.h>.

Syntax

Pass a sine from -1 to 1. Start with this call.

C
asin(1.0);
CallWhat it does
asin(1.0)Returns π/2, the angle whose sine is 1.

Include <math.h>. On GCC, link with -lm. The result is radians.

Library declarations
C
double asin(double x);
float asinf(float x);
long double asinl(long double x);

Parameters

ParameterDescription
xRequired. A sine from -1 to 1.

Return Value

Return ValueDescription
RadiansThe angle from -π/2 to π/2 whose sine is x.
NaNReturned when x is outside -1 to 1.

C Examples

Example 1 — Common asin Values

Print radians for a few sine inputs in the valid domain.

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

int main(void) {
    printf("asin(0)    = %.4f\n", asin(0.0));
    printf("asin(0.5)  = %.4f\n", asin(0.5));
    printf("asin(1)    = %.4f\n", asin(1.0));
    printf("asin(-0.5) = %.4f\n", asin(-0.5));

    return 0;
}

How It Works

  1. Include math.h. Declares asin; link with -lm on GCC.
  2. Zero and half. asin(0) is 0; asin(0.5) is π/6.
  3. Endpoint. asin(1) is π/2 (90°).
  4. Odd function. Negative inputs give negative angles: asin(-0.5) = -asin(0.5).

Example 2 — Convert Radians to Degrees

Multiply by 180 / π when you want a degree reading.

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

int main(void) {
    double x = 0.5;
    double rad = asin(x);
    double pi = acos(-1.0);
    double deg = rad * 180.0 / pi;

    printf("asin(%.1f) = %.4f rad\n", x, rad);
    printf("         = %.2f deg\n", deg);

    return 0;
}

How It Works

  1. Get radians first. asin(0.5) ≈ 0.5236.
  2. Get π portably. acos(-1.0) equals π without needing M_PI.
  3. Scale to degrees. Multiply by 180.0 / pi → 30.
  4. Keep rad for math. Pass radians into sin/cos; use degrees only for display.

Example 3 — Check with sin

Round-trip a value: sin(asin(x)) should recover x on the valid domain.

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

int main(void) {
    double x = 0.75;
    double rad = asin(x);

    printf("asin(%.2f) = %.5f\n", x, rad);
    printf("sin(rad)   = %.5f\n", sin(rad));

    return 0;
}

How It Works

  1. Start with a valid sine. 0.75 is in [-1, 1].
  2. Invert with asin. You get an angle in [-π/2, π/2].
  3. Apply sin. sin(rad) returns to 0.75.
  4. Inverse pair. Use this pattern to verify your understanding of asin and sin.

Frequently Asked Questions

asin() returns the angle, in radians, whose sine is x. asin(0) is 0 and asin(1) is π/2.
x is required. It is a double from -1 to 1.
A double in radians, from -π/2 to π/2. If x is outside -1 to 1, the result is NaN.
Include <math.h>. On GCC, link with -lm.
No. The result is radians. Multiply by 180/π when you want degrees.

Next: asinh()

Compute the inverse hyperbolic sine.

asinh() 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.

9 people found this page helpful