Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>sin() calculate sine</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 sin()                   Calculate Sine

 #include   <math.h>

 double     sin(x);
 double     x;                           Angle, in radians

    sin() returns the sine of 'x' radians.

       Returns:     Sine of 'x'.  If 'x' is so large that a total loss of
                    significance occurs, then matherr() is called with a
                    TLOSS error, a TLOSS error message is printed to
                    'stderr', 'errno' is set to ERANGE, and 0.0 is
                    returned.

         Notes:     Error handling can be modified with the matherr()
                    function.  TLOSS first occurs with 'x' greater than
                    9.0E15.

   -------------------------------- Example ---------------------------------

    The following statements print the sine of pi/2 radians and 2.6e8 pi
    radians and check for any loss of significance.

           #include <math.h>       /* for sin()*/
           #include <stdio.h>      /* for printf() */
           #include <errno.h>     /* for errno and ERANGE */

           main()
           {
               double sine, pi = 3.1415926535;

               sine = sin(pi/2.0);
               printf("sine of pi/2 = %e\n", sine);
               errno = 0;
               sine = sin(2.6e8 * pi);
           /* if a TLOSS error occurs, a message is also printed to stderr */
               if (errno == ERANGE)
                   printf("ERANGE error in sin()\n");
               printf("sine of 2.6e8 * pi = %e\n", sine);
           }


See Also: asin() cos() matherr() sinh() tan()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson