Commit | Line | Data |
---|---|---|
8daa8d7c DF |
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[] = "@(#)acos.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
10 | ||
63e697a2 DF |
11 | /* |
12 | acos(arg) return the arccos, | |
13 | respectively of their arguments. | |
14 | ||
15 | Arctan is called after appropriate range reduction. | |
16 | */ | |
17 | ||
18 | #include <errno.h> | |
19 | int errno; | |
20 | double atan(); | |
21 | double asin(); | |
22 | static double pio2 = 1.570796326794896619; | |
23 | ||
24 | double | |
25 | acos(arg) double arg; { | |
26 | ||
27 | asm(" bispsw $0xe0"); | |
28 | if(arg > 1.|| arg < -1.){ | |
29 | errno = EDOM; | |
30 | return(0.); | |
31 | } | |
32 | ||
33 | return(pio2 - asin(arg)); | |
34 | } |