malloc: Remove __malloc_initialize_hook from the API [BZ #19564]
[glibc.git] / sysdeps / ieee754 / dbl-64 / mpatan2.c
blobe7de6bc158187abbce407937f1459cf9e93d1cf8
1 /*
2 * IBM Accurate Mathematical Library
3 * written by International Business Machines Corp.
4 * Copyright (C) 2001-2016 Free Software Foundation, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 /******************************************************************/
20 /* MODULE_NAME: mpatan2.c */
21 /* */
22 /* FUNCTIONS:mpatan2 */
23 /* */
24 /* FILES NEEDED: mpa.h */
25 /* mpa.c mpatan.c mpsqrt.c */
26 /* */
27 /* Multi-Precision Atan2(y,x) function subroutine, */
28 /* for precision p >= 4. */
29 /* y=0 is not permitted if x<=0. No error messages are given. */
30 /* The relative error of the result is bounded by 44.84*r**(1-p) */
31 /* if x <= 0, y != 0 and by 37.33*r**(1-p) if x>0. here r=2**24. */
32 /* */
33 /******************************************************************/
35 #include "mpa.h"
37 #ifndef SECTION
38 # define SECTION
39 #endif
41 /* Multi-Precision Atan2 (y, x) function subroutine, for p >= 4.
42 y = 0 is not permitted if x <= 0. No error messages are given. */
43 void
44 SECTION
45 __mpatan2 (mp_no *y, mp_no *x, mp_no *z, int p)
47 mp_no mpt1, mpt2, mpt3;
49 if (X[0] <= 0)
51 __dvd (x, y, &mpt1, p);
52 __mul (&mpt1, &mpt1, &mpt2, p);
53 if (mpt1.d[0] != 0)
54 mpt1.d[0] = 1;
55 __add (&mpt2, &__mpone, &mpt3, p);
56 __mpsqrt (&mpt3, &mpt2, p);
57 __add (&mpt1, &mpt2, &mpt3, p);
58 mpt3.d[0] = Y[0];
59 __mpatan (&mpt3, &mpt1, p);
60 __add (&mpt1, &mpt1, z, p);
62 else
64 __dvd (y, x, &mpt1, p);
65 __mpatan (&mpt1, z, p);