|
|
1.1 root 1: /*
2: computes a^b.
3: uses log and exp
4: */
5:
6: #include <errno.h>
7: int errno;
8: double log(), exp();
9:
10: double
11: pow(arg1,arg2)
12: double arg1, arg2;
13: {
14: double temp;
15: long l;
16:
17: asm(" bispsw $0xe0");
18: if(arg1 <= 0.) {
19: if(arg1 == 0.) {
20: if(arg2 <= 0.)
21: goto domain;
22: return(0.);
23: }
24: l = arg2;
25: if(l != arg2)
26: goto domain;
27: temp = exp(arg2 * log(-arg1));
28: if(l & 1)
29: temp = -temp;
30: return(temp);
31: }
32: return(exp(arg2 * log(arg1)));
33:
34: domain:
35: errno = EDOM;
36: return(0.);
37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.