1: /*	@(#)pow.c	4.2	6/30/83	*/
   2: 
   3: /*
   4: 	computes a^b.
   5: 	uses log and exp
   6: */
   7: 
   8: #include    <errno.h>
   9: int errno;
  10: double log(), exp();
  11: 
  12: double
  13: pow(arg1,arg2)
  14: double arg1, arg2;
  15: {
  16:     double temp;
  17:     long l;
  18: 
  19: #ifdef vax
  20:     asm("	bispsw	$0xe0");
  21: #endif
  22:     if(arg1 <= 0.) {
  23:         if(arg1 == 0.) {
  24:             if(arg2 <= 0.)
  25:                 goto domain;
  26:             return(0.);
  27:         }
  28:         l = arg2;
  29:         if(l != arg2)
  30:             goto domain;
  31:         temp = exp(arg2 * log(-arg1));
  32:         if(l & 1)
  33:             temp = -temp;
  34:         return(temp);
  35:     }
  36:     return(exp(arg2 * log(arg1)));
  37: 
  38: domain:
  39:     errno = EDOM;
  40:     return(0.);
  41: }

Defined functions

pow defined in line 12; never used

Defined variables

errno defined in line 9; used 1 times
  • in line 39
Last modified: 1985-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 823
Valid CSS Valid XHTML 1.0 Strict