Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

sin, sinf, sinh, sinhf 

Calculate sines and hyperbolic sines.

double sin(
   double x 
float sin(
   float x
);  // C++ only
long double sin(
   long double x
);  // C++ only
float sinf(
   float x 
double sinh(
   double x 
float sinh(
   float x 
);  // C++ only
long double sinh(
   long double x
);  // C++ only
float sinhf(
   float x



Angle in radians.

sin returns the sine of x. If x is greater than or equal to 263, or less than or equal to –263, a loss of significance in the result occurs

sinh returns the hyperbolic sine of x. If the result is too large, sinh sets errno to ERANGE and returns ±HUGE_VAL, by default.

Input SEH Exception Matherr Exception




± ∞ (sin, sinf)



|x| ≥ 7.104760e+002 (sinh, sinhf)



See _doserrno, errno, _sys_errlist, and _sys_nerr for more information on these, and other, return codes.

C++ allows overloading, so users can call overloads of sin and sinh that take double, float or long double types. In a C program, the sin and sinh functions always take and return double and float, respectively.

Routine Required header Compatibility

sin, sinf, sinh, sinhf


ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For additional compatibility information, see Compatibility in the Introduction.

// crt_sincos.c
// This program displays the sine, hyperbolic
// sine, cosine, and hyperbolic cosine of pi / 2.

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

int main( void )
   double pi = 3.1415926535;
   double x, y;

   x = pi / 2;
   y = sin( x );
   printf( "sin( %f ) = %f\n", x, y );
   y = sinh( x );
   printf( "sinh( %f ) = %f\n",x, y );
   y = cos( x );
   printf( "cos( %f ) = %f\n", x, y );
   y = cosh( x );
   printf( "cosh( %f ) = %f\n",x, y );


sin( 1.570796 ) = 1.000000
sinh( 1.570796 ) = 2.301299
cos( 1.570796 ) = 0.000000
cosh( 1.570796 ) = 2.509178

Community Additions

© 2015 Microsoft