/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:31:59 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include "ssnpxx.h" #include #include float /*FUNCTION*/ ssnpxx( float x) { long int _l0, j, k, n; float f, g, ssnpxx_v; static float bigx = -1.0e0; /* Copyright (c) 1996 California Institute of Technology, Pasadena, CA. * ALL RIGHTS RESERVED. * Based on Government Sponsored Research NAS7-03001. *--S replaces "?": ?SNPXX, ?COSPX, ?SINPX *>> 2001-07-16 SSNPXX Krogh Change -1.0 to -1.e0. *>> 1998-10-29 SSNPXX Krogh Moved external statement up for mangle. *>> 1996-01-08 SSNPXX WV Snyder Original code */ /* SIN(PI * X * X / 2) carefully to avoid loss of precision for large X */ /* SSINPX is used to compute SIN(PI * X) */ /* BIGX = 1 / round-off = biggest integer exactly representable by F.P. * If X > BIGX then to the working precision x**2 is an integer (which * we assume to be a multiple of four), so sin(pi/2 * x**2) = 0. * N = [X], and later [K F] * F = X - N = fractional part of X * K = [ N / 2 ] * J = N mod 2 * G = K F - M = fractional part of K F */ if (bigx < 0.0e0) bigx = 1.0e0/FLT_EPSILON; f = fabsf( x ); if (f > bigx) { /* Assume x is an even integer. */ ssnpxx_v = 0.0e0; return( ssnpxx_v ); } n = f; f -= n; k = n/2; j = n%2; g = k*f; n = g; g -= n; if (j == 0) { ssnpxx_v = ssinpx( 0.5e0*f*f + g + g ); } else { ssnpxx_v = scospx( 0.5e0*f*f + f + g + g ); } return( ssnpxx_v ); } /* end of function */