~ubuntu-branches/ubuntu/trusty/eglibc/trusty

« back to all changes in this revision

Viewing changes to math/s_csqrtl.c

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-01-10 18:39:35 UTC
  • mfrom: (1.5.2) (4.4.24 experimental)
  • Revision ID: package-import@ubuntu.com-20130110183935-afsgfxkmg7wk5eaj
Tags: 2.17-0ubuntu1
* Merge with Debian, bringing in a new upstream and many small fixes:
  - patches/any/cvs-malloc-deadlock.diff: Dropped, merged upstream.
  - patches/ubuntu/lddebug-scopes.diff: Rebase for upstream changes.
  - patches/ubuntu/local-CVE-2012-3406.diff: Rebased against upstream.
  - patches/ubuntu/no-asm-mtune-i686.diff: Fixed in recent binutils.
* This upstream merge fixes a nasty hang in pulseaudio (LP: #1085342)
* Bump MIN_KERNEL_SUPPORTED to 2.6.32 on ARM, now that we no longer
  have to support shonky 2.6.31 kernels on imx51 babbage builders.
* Drop patches/ubuntu/local-disable-nscd-host-caching.diff, as these
  issues were apparently resolved upstream a while ago (LP: #613662)
* Fix the compiled-in bug URL to point to launchpad.net, not Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        }
76
76
      else if (__builtin_expect (rcls == FP_ZERO, 0))
77
77
        {
78
 
          long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
 
78
          long double r;
 
79
          if (fabsl (__imag__ x) >= 2.0L * LDBL_MIN)
 
80
            r = __ieee754_sqrtl (0.5L * fabsl (__imag__ x));
 
81
          else
 
82
            r = 0.5L * __ieee754_sqrtl (2.0L * fabsl (__imag__ x));
79
83
 
80
84
          __real__ res = r;
81
85
          __imag__ res = __copysignl (r, __imag__ x);
85
89
          long double d, r, s;
86
90
          int scale = 0;
87
91
 
88
 
          if (fabsl (__real__ x) > LDBL_MAX / 2.0L
89
 
              || fabsl (__imag__ x) > LDBL_MAX / 2.0L)
 
92
          if (fabsl (__real__ x) > LDBL_MAX / 4.0L)
90
93
            {
91
94
              scale = 1;
92
95
              __real__ x = __scalbnl (__real__ x, -2 * scale);
93
96
              __imag__ x = __scalbnl (__imag__ x, -2 * scale);
94
97
            }
 
98
          else if (fabsl (__imag__ x) > LDBL_MAX / 4.0L)
 
99
            {
 
100
              scale = 1;
 
101
              if (fabsl (__real__ x) >= 4.0L * LDBL_MIN)
 
102
                __real__ x = __scalbnl (__real__ x, -2 * scale);
 
103
              else
 
104
                __real__ x = 0.0L;
 
105
              __imag__ x = __scalbnl (__imag__ x, -2 * scale);
 
106
            }
95
107
          else if (fabsl (__real__ x) < LDBL_MIN
96
108
                   && fabsl (__imag__ x) < LDBL_MIN)
97
109
            {
105
117
             to avoid cancellation error in  d +/- Re x.  */
106
118
          if (__real__ x > 0)
107
119
            {
108
 
              r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x);
109
 
              s = (0.5L * __imag__ x) / r;
 
120
              r = __ieee754_sqrtl (0.5L * (d + __real__ x));
 
121
              s = 0.5L * (__imag__ x / r);
110
122
            }
111
123
          else
112
124
            {
113
 
              s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
114
 
              r = fabsl ((0.5L * __imag__ x) / s);
 
125
              s = __ieee754_sqrtl (0.5L * (d - __real__ x));
 
126
              r = fabsl (0.5L * (__imag__ x / s));
115
127
            }
116
128
 
117
129
          if (scale)