/* * IBM Accurate Mathematical Library * Copyright (C) 2001-2022 Free Software Foundation, Inc. * * This program 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 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 this program; if not, see <https://www.gnu.org/licenses/>. */ /*******************************************************************/ /* */ /* MODULE_NAME: branred.c */ /* */ /* FUNCTIONS: branred */ /* */ /* FILES NEEDED: branred.h mydefs.h endian.h mpa.h */ /* mha.c */ /* */ /* Routine branred() performs range reduction of a double number */ /* x into Double length number a+aa,such that */ /* x=n*pi/2+(a+aa), abs(a+aa)<pi/4, n=0,+-1,+-2,.... */ /* Routine returns the integer (n mod 4) of the above description */ /* of x. */ /*******************************************************************/ #include "endian.h" #include "mydefs.h" #include "branred.h" #include <math.h> #ifndef SECTION #define SECTION #endif /*******************************************************************/ /* Routine branred() performs range reduction of a double number */ /* x into Double length number a+aa,such that */ /* x=n*pi/2+(a+aa), abs(a+aa)<pi/4, n=0,+-1,+-2,.... */ /* Routine return integer (n mod 4) */ /*******************************************************************/ int SECTION __branred(double x, double *a, double *aa) { … }