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

« back to all changes in this revision

Viewing changes to math/s_catanhl.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 arc hyperbole tangent for long double value.
2
 
   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 1997, 1998 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
 
20
20
 
21
21
#include <complex.h>
22
22
#include <math.h>
23
 
#include <math_private.h>
 
23
 
 
24
#include "math_private.h"
24
25
 
25
26
 
26
27
__complex__ long double
30
31
  int rcls = fpclassify (__real__ x);
31
32
  int icls = fpclassify (__imag__ x);
32
33
 
33
 
  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
 
34
  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
34
35
    {
35
36
      if (icls == FP_INFINITE)
36
37
        {
51
52
          __imag__ res = __nanl ("");
52
53
        }
53
54
    }
54
 
  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
 
55
  else if (rcls == FP_ZERO && icls == FP_ZERO)
55
56
    {
56
57
      res = x;
57
58
    }
58
59
  else
59
60
    {
60
 
      long double i2 = __imag__ x * __imag__ x;
61
 
 
62
 
      long double num = 1.0 + __real__ x;
 
61
      long double i2, num, den;
 
62
 
 
63
      i2 = __imag__ x * __imag__ x;
 
64
 
 
65
      num = 1.0 + __real__ x;
63
66
      num = i2 + num * num;
64
67
 
65
 
      long double den = 1.0 - __real__ x;
 
68
      den = 1.0 - __real__ x;
66
69
      den = i2 + den * den;
67
70
 
68
71
      __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));