Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
/* k_sinf.c -- float version of k_sin.c
3
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
4
 */
5
 
6
/*
7
 * ====================================================
8
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9
 *
10
 * Developed at SunPro, a Sun Microsystems, Inc. business.
11
 * Permission to use, copy, modify, and distribute this
12
 * software is freely granted, provided that this notice
13
 * is preserved.
14
 * ====================================================
15
 */
16
 
17
#if defined(LIBM_SCCS) && !defined(lint)
18
static char rcsid[] = "$Id: k_sinf.c,v 1.2 1994/08/18 23:06:15 jtc Exp $";
19
#endif
20
 
21
#include "math.h"
22
#include "math_private.h"
23
 
24
#ifdef __STDC__
25
static const float
26
#else
27
static float
28
#endif
29
half =  5.0000000000e-01,/* 0x3f000000 */
30
S1  = -1.6666667163e-01, /* 0xbe2aaaab */
31
S2  =  8.3333337680e-03, /* 0x3c088889 */
32
S3  = -1.9841270114e-04, /* 0xb9500d01 */
33
S4  =  2.7557314297e-06, /* 0x3638ef1b */
34
S5  = -2.5050759689e-08, /* 0xb2d72f34 */
35
S6  =  1.5896910177e-10; /* 0x2f2ec9d3 */
36
 
37
#ifdef __STDC__
38
	float __kernel_sinf(float x, float y, int iy)
39
#else
40
	float __kernel_sinf(x, y, iy)
41
	float x,y; int iy;		/* iy=0 if y is zero */
42
#endif
43
{
44
	float z,r,v;
45
	int32_t ix;
46
	GET_FLOAT_WORD(ix,x);
47
	ix &= 0x7fffffff;			/* high word of x */
48
	if(ix<0x32000000)			/* |x| < 2**-27 */
49
	   {if((int)x==0) return x;}		/* generate inexact */
50
	z	=  x*x;
51
	v	=  z*x;
52
	r	=  S2+z*(S3+z*(S4+z*(S5+z*S6)));
53
	if(iy==0) return x+v*(S1+z*r);
54
	else      return x-((z*(half*y-v*r)-y)-v*S1);
55
}