The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
We recommend using Visual Studio 2017

sin, sinf, sinl, sinh, sinhf, sinhl


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at sin, sinf, sinl, sinh, sinhf, sinhl.

Calculates 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   
long double sinl(   long double x  
double sinh(  
   double x   
float sinh(  
   float x   
);  // C++ only  
long double sinh(  
   long double x  
);  // C++ only  
float sinhf(  
   float x  
long double sinhl(  
   long double x  


Angle in radians.

The sin functions return 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.

The sinh functions return the hyperbolic sine of x. By default, if the result is too large, sinh sets errno to ERANGE and returns ±HUGE_VAL.

InputSEH ExceptionMatherr Exception
± ∞ (sin, sinf, sinl)INVALID_DOMAIN
|x| ≥ 7.104760e+002 (sinh, sinhf, sinhl)OVERFLOW+INEXACTOVERFLOW

For more information about return codes, see errno, _doserrno, _sys_errlist, and _sys_nerr.

Because C++ allows overloading, you can call overloads of sin and sinh that take and return float or long double values. In a C program, sin and sinh always take and return double.

RoutineRequired header
sin, sinf, sinl, sinh, sinhf, sinhl<math.h>

For additional compatibility information, see Compatibility.

// 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  

Floating-Point Support
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
cos, cosf, cosl, cosh, coshf, coshl
tan, tanf, tanl, tanh, tanhf, tanhl