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

Defined functions

asin defined in line 16; used 7 times

Defined variables

errno defined in line 11; used 2 times
pio2 defined in line 14; used 2 times
Last modified: 1985-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 582
Valid CSS Valid XHTML 1.0 Strict