/* Optimized with sse2 version of sinf
Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
#define __need_Emath
#include <bits/errno.h>
/* Short algorithm description:
*
* 1) if |x| == 0: return x.
* 2) if |x| < 2^-27: return x-x*DP_SMALL, raise underflow only when needed.
* 3) if |x| < 2^-5 : return x+x^3*DP_SIN2_0+x^5*DP_SIN2_1.
* 4) if |x| < Pi/4: return x+x^3*(S0+x^2*(S1+x^2*(S2+x^2*(S3+x^2*S4)))).
* 5) if |x| < 9*Pi/4:
* 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+1,
* t=|x|-j*Pi/4.
* 5.2) Reconstruction:
* s = sign(x) * (-1.0)^((n>>2)&1)
* if(n&2 != 0) {
* using cos(t) polynomial for |t|<Pi/4, result is
* s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4))))).
* } else {
* using sin(t) polynomial for |t|<Pi/4, result is
* s