sin Functions>

Description

Calculate sines and hyperbolic sines.

#include <math.h>

double sin( double x );

double sinh( double x );

long double _sinl( long double x );

long double _sinhl( long double x );

x Angle in radians  

Remarks

The sin and sinh functions find the sine and hyperbolic sine of x, respectively. The _sinl and _sinhl functions are the 80-bit counterparts and use an 80-bit, 10-byte coprocessor form of arguments and return values. See the reference page on the long double functions for more details on this data type.

Return Value

The sin functions return the sine of x. If x is large, a partial loss of significance in the result may occur, and sin generates a _PLOSS error. If x is so large that significance is completely lost, the sin function prints a _TLOSS message to stderr and returns 0. In both cases, errno is set to ERANGE.

The sinh function returns the hyperbolic sine of x. If the result is too large, sinh sets errno to ERANGE and returns ±HUGE_VAL. Error handling can be changed with the _matherr function.

Compatibility

sin, sinh

Standards:ANSI, UNIX

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

_sinl, _sinhl

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

acos functions, asin functions, atan functions, cos functions, tan functions

Example

/* SINCOS.C: This program displays the sine, hyperbolic sine, cosine,

* and hyperbolic cosine of pi / 2.

*/

#include <math.h>

#include <stdio.h>

void 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 );

}

Output

sin( 1.570796 ) = 1.000000

sinh( 1.570796 ) = 2.301299

cos( 1.570796 ) = 0.000000

cosh( 1.570796 ) = 2.509178