mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 16:26:12 +08:00
* mingwex/complex/csqrt.c (csqrt): The sign of real part
of result is positive when real part of arg == 0; * mingwex/complex/csqrtf.c (csqrtf): Ditto. * mingwex/complex/csqrtl.c (csqrtl): Ditto.
This commit is contained in:
parent
1a5c68c8d9
commit
0efe737420
@ -1,3 +1,10 @@
|
|||||||
|
2005-10-12 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
|
* mingwex/complex/csqrt.c (csqrt): The sign of real part
|
||||||
|
of result is positive when real part of arg == 0;
|
||||||
|
* mingwex/complex/csqrtf.c (csqrtf): Ditto.
|
||||||
|
* mingwex/complex/csqrtl.c (csqrtl): Ditto.
|
||||||
|
|
||||||
2005-10-12 Danny Smith <dannysmith@users.sourceforge.net>
|
2005-10-12 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
* include/time.h (_time64): Correct prototype.
|
* include/time.h (_time64): Correct prototype.
|
||||||
|
@ -31,22 +31,23 @@ double complex csqrt (double complex Z)
|
|||||||
else if (x == 0.0)
|
else if (x == 0.0)
|
||||||
{
|
{
|
||||||
t = sqrt(0.5 * fabs (y));
|
t = sqrt(0.5 * fabs (y));
|
||||||
__real__ Res = y > 0 ? t : -t;
|
__real__ Res = t;
|
||||||
__imag__ Res = t;
|
__imag__ Res = y > 0 ? t : -t;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t = sqrt (2.0 * (_hypot (x, y) + fabs (x)));
|
t = sqrt (2.0 * (_hypot (x, y) + fabs (x)));
|
||||||
|
double u = t / 2.0;
|
||||||
if ( x > 0.0)
|
if ( x > 0.0)
|
||||||
{
|
{
|
||||||
__real__ Res = 0.5 * t;
|
__real__ Res = u;
|
||||||
__imag__ Res = y / t;
|
__imag__ Res = y / t;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__real__ Res = fabs ( y / t);
|
__real__ Res = fabs ( y / t);
|
||||||
__imag__ Res = (y < 0.0 ? -0.5 : 0.5) * t;
|
__imag__ Res = y < 0.0 ? -u : u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ float complex csqrtf (float complex Z)
|
|||||||
else if (x == 0.0f)
|
else if (x == 0.0f)
|
||||||
{
|
{
|
||||||
r = sqrtf(0.5f * fabsf (y));
|
r = sqrtf(0.5f * fabsf (y));
|
||||||
__real__ Res = y > 0 ? r : -r;
|
__real__ Res = r;
|
||||||
__imag__ Res = r;
|
__imag__ Res = y > 0 ? r : -r;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -31,8 +31,8 @@ long double complex csqrtl (long double complex Z)
|
|||||||
else if (x == 0.0L)
|
else if (x == 0.0L)
|
||||||
{
|
{
|
||||||
r = sqrtl(0.5L * fabsl (y));
|
r = sqrtl(0.5L * fabsl (y));
|
||||||
__real__ Res = y > 0 ? r : -r;
|
__real__ Res = r;
|
||||||
__imag__ Res = r;
|
__imag__ Res = y > 0 ? r : -r;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user