X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ftrigl.c;h=6f9dcf526568adf55b6ef5955057fbbbc30db653;hb=a5bd4a560247e63db562041f9d136ba83a8b95fb;hp=4e33f78376d986263c3fdf83d306bca0c82a2307;hpb=5657b2536d242966c41c268b9ab4fe8df727bb13;p=gnulib.git diff --git a/lib/trigl.c b/lib/trigl.c index 4e33f7837..6f9dcf526 100644 --- a/lib/trigl.c +++ b/lib/trigl.c @@ -1,27 +1,27 @@ /* Quad-precision floating point argument reduction. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek - 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. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. - The GNU C Library is distributed in the hope that it will be useful, + This program 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ +#include + +/* Specification. */ #include -#include -#include "mathl.h" +#include /* Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi */ static const int two_over_pi[] = { @@ -205,7 +205,7 @@ ieee754_rem_pio2l (long double x, long double *y) int exp, n; if (x >= -0.78539816339744830961566084581987572104929234984377 - && x < 0.78539816339744830961566084581987572104929234984377) + && x <= 0.78539816339744830961566084581987572104929234984377) /* x in <-pi/4, pi/4> */ { y[0] = x; @@ -213,9 +213,7 @@ ieee754_rem_pio2l (long double x, long double *y) return 0; } - if (x >= 2.35619449019234492884698253745962716314787704953131 - && x < 2.35619449019234492884698253745962716314787704953131) - if (x > 0) + if (x > 0 && x < 2.35619449019234492884698253745962716314787704953131) { /* 113 + 93 bit PI is ok */ z = x - PI_2_1; @@ -223,7 +221,8 @@ ieee754_rem_pio2l (long double x, long double *y) y[1] = (z - y[0]) - PI_2_1t; return 1; } - else + + if (x < 0 && x > -2.35619449019234492884698253745962716314787704953131) { /* 113 + 93 bit PI is ok */ z = x + PI_2_1; @@ -232,7 +231,7 @@ ieee754_rem_pio2l (long double x, long double *y) return -1; } - if (x + x == x || x != x) /* x is +=oo or NaN */ + if (x + x == x) /* x is ±oo */ { y[0] = x - x; y[1] = y[0]; @@ -422,7 +421,7 @@ static const double PIo2[] = { static const double zero = 0.0, one = 1.0, two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ -int +static int kernel_rem_pio2 (double *x, double *y, int e0, int nx, int prec, const int *ipio2) {