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

« back to all changes in this revision

Viewing changes to math/s_cexpf.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
/* Return value of complex exponential function for float complex value.
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
 
21
21
#include <complex.h>
22
22
#include <fenv.h>
23
23
#include <math.h>
24
 
#include <math_private.h>
 
24
 
 
25
#include "math_private.h"
25
26
 
26
27
 
27
28
__complex__ float
31
32
  int rcls = fpclassify (__real__ x);
32
33
  int icls = fpclassify (__imag__ x);
33
34
 
34
 
  if (__builtin_expect (rcls >= FP_ZERO, 1))
 
35
  if (rcls >= FP_ZERO)
35
36
    {
36
37
      /* Real part is finite.  */
37
 
      if (__builtin_expect (icls >= FP_ZERO, 1))
 
38
      if (icls >= FP_ZERO)
38
39
        {
39
40
          /* Imaginary part is finite.  */
40
41
          float exp_val = __ieee754_expf (__real__ x);
60
61
          __real__ retval = __nanf ("");
61
62
          __imag__ retval = __nanf ("");
62
63
 
 
64
#ifdef FE_INVALID
63
65
          feraiseexcept (FE_INVALID);
 
66
#endif
64
67
        }
65
68
    }
66
 
  else if (__builtin_expect (rcls == FP_INFINITE, 1))
 
69
  else if (rcls == FP_INFINITE)
67
70
    {
68
71
      /* Real part is infinite.  */
69
 
      if (__builtin_expect (icls >= FP_ZERO, 1))
 
72
      if (icls >= FP_ZERO)
70
73
        {
71
74
          /* Imaginary part is finite.  */
72
75
          float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
92
95
          __real__ retval = HUGE_VALF;
93
96
          __imag__ retval = __nanf ("");
94
97
 
 
98
#ifdef FE_INVALID
95
99
          if (icls == FP_INFINITE)
96
100
            feraiseexcept (FE_INVALID);
 
101
#endif
97
102
        }
98
103
      else
99
104
        {
107
112
      __real__ retval = __nanf ("");
108
113
      __imag__ retval = __nanf ("");
109
114
 
 
115
#ifdef FE_INVALID
110
116
      if (rcls != FP_NAN || icls != FP_NAN)
111
117
        feraiseexcept (FE_INVALID);
 
118
#endif
112
119
    }
113
120
 
114
121
  return retval;