~ubuntu-branches/ubuntu/precise/eglibc/precise

« back to all changes in this revision

Viewing changes to math/s_ccoshf.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-10-04 17:48:26 UTC
  • mfrom: (216.1.23 oneiric)
  • Revision ID: package-import@ubuntu.com-20111004174826-2cyb9ewn3ucymlsx
Tags: 2.13-20ubuntu5
libc6-dev: Don't break the current {gnat,gcj}-4.4-base versons. LP: #853688.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Complex cosine hyperbole function for float.
2
 
   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 1997 Free Software Foundation, Inc.
3
3
   This file is part of the GNU C Library.
4
4
   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5
5
 
22
22
#include <fenv.h>
23
23
#include <math.h>
24
24
 
25
 
#include <math_private.h>
 
25
#include "math_private.h"
26
26
 
27
27
 
28
28
__complex__ float
32
32
  int rcls = fpclassify (__real__ x);
33
33
  int icls = fpclassify (__imag__ x);
34
34
 
35
 
  if (__builtin_expect (rcls >= FP_ZERO, 1))
 
35
  if (rcls >= FP_ZERO)
36
36
    {
37
37
      /* Real part is finite.  */
38
 
      if (__builtin_expect (icls >= FP_ZERO, 1))
 
38
      if (icls >= FP_ZERO)
39
39
        {
40
40
          /* Imaginary part is finite.  */
41
41
          float sinh_val = __ieee754_sinhf (__real__ x);
52
52
          __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
53
53
          __real__ retval = __nanf ("");
54
54
 
 
55
#ifdef FE_INVALID
55
56
          if (icls == FP_INFINITE)
56
57
            feraiseexcept (FE_INVALID);
 
58
#endif
57
59
        }
58
60
    }
59
 
  else if (__builtin_expect (rcls == FP_INFINITE, 1))
 
61
  else if (rcls == FP_INFINITE)
60
62
    {
61
63
      /* Real part is infinite.  */
62
 
      if (__builtin_expect (icls > FP_ZERO, 1))
 
64
      if (icls == FP_ZERO)
 
65
        {
 
66
          /* Imaginary part is 0.0.  */
 
67
          __real__ retval = HUGE_VALF;
 
68
          __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
 
69
        }
 
70
      else if (icls > FP_ZERO)
63
71
        {
64
72
          /* Imaginary part is finite.  */
65
73
          float sinix, cosix;
70
78
          __imag__ retval = (__copysignf (HUGE_VALF, sinix)
71
79
                             * __copysignf (1.0, __real__ x));
72
80
        }
73
 
      else if (icls == FP_ZERO)
74
 
        {
75
 
          /* Imaginary part is 0.0.  */
76
 
          __real__ retval = HUGE_VALF;
77
 
          __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
78
 
        }
79
81
      else
80
82
        {
81
83
          /* The addition raises the invalid exception.  */