1: /*
   2: 	asin(arg) and acos(arg) return the arcsin, arccos,
   3: 	respectively of their arguments.
   4: 
   5: 	Arctan is called after appropriate range reduction.
   6: */
   7: 
   8: #include    <errno.h>
   9: int errno;
  10: double atan();
  11: double sqrt();
  12: static double pio2  = 1.570796326794896619;
  13: 
  14: double
  15: asin(arg) double arg; {
  16: 
  17:     double sign, temp;
  18: 
  19:     sign = 1.;
  20:     if(arg <0){
  21:         arg = -arg;
  22:         sign = -1.;
  23:     }
  24: 
  25:     if(arg > 1.){
  26:         errno = EDOM;
  27:         return(0.);
  28:     }
  29: 
  30:     temp = sqrt(1. - arg*arg);
  31:     if(arg > 0.7)
  32:         temp = pio2 - atan(temp/arg);
  33:     else
  34:         temp = atan(arg/temp);
  35: 
  36:     return(sign*temp);
  37: }
  38: 
  39: double
  40: acos(arg) double arg; {
  41: 
  42:     if((arg > 1.) || (arg < -1.)){
  43:         errno = EDOM;
  44:         return(0.);
  45:     }
  46: 
  47:     return(pio2 - asin(arg));
  48: }

Defined functions

acos defined in line 39; used 5 times
asin defined in line 14; used 6 times

Defined variables

errno defined in line 9; used 2 times
pio2 defined in line 12; used 2 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 708
Valid CSS Valid XHTML 1.0 Strict