1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)pow.c	5.1 (Berkeley) 5/8/85";
   9: #endif not lint
  10: 
  11: /*
  12: 	computes a^b.
  13: 	uses log and exp
  14: */
  15: 
  16: #include    <errno.h>
  17: int errno;
  18: double log(), exp();
  19: 
  20: double
  21: pow(arg1,arg2)
  22: double arg1, arg2;
  23: {
  24:     double temp;
  25:     long l;
  26: 
  27:     asm("	bispsw	$0xe0");
  28:     if(arg1 <= 0.) {
  29:         if(arg1 == 0.) {
  30:             if(arg2 <= 0.)
  31:                 goto domain;
  32:             return(0.);
  33:         }
  34:         l = arg2;
  35:         if(l != arg2)
  36:             goto domain;
  37:         temp = exp(arg2 * log(-arg1));
  38:         if(l & 1)
  39:             temp = -temp;
  40:         return(temp);
  41:     }
  42:     return(exp(arg2 * log(arg1)));
  43: 
  44: domain:
  45:     errno = EDOM;
  46:     return(0.);
  47: }

Defined functions

pow defined in line 20; never used

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-05-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 801
Valid CSS Valid XHTML 1.0 Strict