annotate libquadmath/math/cacosq.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
1 /* Return cosine of a complex type.
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
2 Copyright (C) 1997-2018 Free Software Foundation, Inc.
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 This file is part of the GNU C Library.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 The GNU C Library is free software; you can redistribute it and/or
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 modify it under the terms of the GNU Lesser General Public
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 License as published by the Free Software Foundation; either
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version 2.1 of the License, or (at your option) any later version.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 The GNU C Library is distributed in the hope that it will be useful,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 Lesser General Public License for more details.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU Lesser General Public
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
17 License along with the GNU C Library; if not, see
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
18 <http://www.gnu.org/licenses/>. */
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #include "quadmath-imp.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 __complex128
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 cacosq (__complex128 x)
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 {
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 __complex128 y;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 __complex128 res;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
27 int rcls = fpclassifyq (__real__ x);
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
28 int icls = fpclassifyq (__imag__ x);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
30 if (rcls <= QUADFP_INFINITE || icls <= QUADFP_INFINITE
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
31 || (rcls == QUADFP_ZERO && icls == QUADFP_ZERO))
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
32 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
33 y = casinq (x);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
35 __real__ res = (__float128) M_PI_2q - __real__ y;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
36 if (__real__ res == 0)
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
37 __real__ res = 0;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
38 __imag__ res = -__imag__ y;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
39 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
40 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
41 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
42 __real__ y = -__imag__ x;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
43 __imag__ y = __real__ x;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
44
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
45 y = __quadmath_kernel_casinhq (y, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
46
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
47 __real__ res = __imag__ y;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
48 __imag__ res = __real__ y;
1830386684a0 gcc-9.2.0
anatofuz
parents: 68
diff changeset
49 }
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 return res;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 }