ftp.nice.ch/pub/next/developer/hardware/m68k/SoftwareMathCoprocFor68040.2.0.N.sa.tar.gz#/libjv/asin.c

This is asin.c in view mode; [Download] [Up]

#include <stdio.h>
static double pid2= 1.5707963267948966192;

double jv_asin(x)
double x;
{
	double y,y2,sum,jv_sqrt();
	int sflag, yflag;
	if ( x < 0 ) { sflag = 1; x = -x; }
	else sflag = 0;
	if ( x > 0.5 ) {
		if ( x > 1.0 ) {
			if ( sflag ) x = -x;
			fprintf(stderr,"Argument out of range in asin: %f\n",x);
			exit(-1);
		}
		y = jv_sqrt(0.5*(1.-x));
		yflag = 1;
	}
	else { y = x; yflag = 0; }
	y2 = y*y;
	sum = y * ( 1.00000000000000001365+y2*(
			    0.16666666666664838839+y2*(
			    0.07500000000404881646+y2*(
			    0.04464285679119552341+y2*(
			    0.03038196027237537659+y2*(
			    0.02237173658111094020+y2*(
			    0.01735997031086759961+y2*(
			    0.01388302431756389624+y2*(
			    0.01218170270685370993+y2*(
			    0.00648075111416853345+y2*(
			    0.01964268701248804731+y2*(
			   -0.01638489913725409907+y2*(
			    0.03201166198466493988)))))))))))));
	if ( yflag ) sum = pid2 - 2.*sum;
	if ( sflag ) return(-sum);
	else return(sum);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.