xref: /csrg-svn/old/libm/liboldnm/acos.c (revision 20008)
120002Sdist /*
2*20008Sdist  * Copyright (c) 1980 Regents of the University of California.
3*20008Sdist  * All rights reserved.  The Berkeley software License Agreement
4*20008Sdist  * specifies the terms and conditions for redistribution.
5*20008Sdist  */
6*20008Sdist 
7*20008Sdist #ifndef lint
8*20008Sdist static char sccsid[] = "@(#)acos.c	5.1 (Berkeley) 05/08/85";
9*20008Sdist #endif not lint
10*20008Sdist 
11*20008Sdist /*
1220002Sdist acos(arg) return the arccos,
1320002Sdist 	respectively of their arguments.
1420002Sdist 
1520002Sdist 	Arctan is called after appropriate range reduction.
1620002Sdist */
1720002Sdist 
1820002Sdist #include	<errno.h>
1920002Sdist int errno;
2020002Sdist double atan();
2120002Sdist double asin();
2220002Sdist static double pio2	= 1.570796326794896619;
2320002Sdist 
2420002Sdist double
acos(arg)2520002Sdist acos(arg) double arg; {
2620002Sdist 
2720002Sdist 	asm("	bispsw	$0xe0");
2820002Sdist 	if(arg > 1.|| arg < -1.){
2920002Sdist 		errno = EDOM;
3020002Sdist 		return(0.);
3120002Sdist 	}
3220002Sdist 
3320002Sdist 	return(pio2 - asin(arg));
3420002Sdist }
35