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>asin() calculate arc sine</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 asin()                  Calculate Arc Sine

 #include   <math.h>

 double     asin(x);                     Arc sine (in radians)
 double     x;

    asin() returns the arc sine of 'x' in radians.  'x' must be in the
    range -1.0 to 1.0; the value returned is in the range -./2 to ./2.

       Returns:     The arc sine of 'x'.  If 'x' < -1.0 or > 1.0, then
                    matherr() is called with a DOMAIN error; 'errno'
                    (defined in <errno.h>) is set to EDOM (defined in
                    <math.h>); a domain error message is printed to
                    'stderr'; and 0.0 is returned.


         Notes:     You can modify error handling with the matherr()
                    routine.

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

    The following statements continue printing the arc sines of the
    values in an array until a DOMAIN error occurs.

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

                                /* the value 3.141 will cause an error */
           double sines[6] = {0.707, 0.0, 1.0, -1.0, 3.141, -0.2};

           main()
           {
               double arc_sine;
               int i;

               errno = 0;
               for (i = 0;  !errno && i < 6;  i++) {
                   arc_sine = asin(sines[i]);
                   if (errno == EDOM) /* an error is also printed to stderr
           */
                       printf("DOMAIN error in asin()\n");
                   printf("arc sine of %f = %f radians\n", sines[i],
                          arc_sine);
               }
           }


See Also: matherr() sin() sinh()

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