Cross Reference: _X_cplx_lr_div.c
xref
: /
osnet-11
/
usr
/
src
/
lib
/
libc
/
i386
/
fp
/
_X_cplx_lr_div.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
2
N/A
/*
2
N/A
* CDDL HEADER START
2
N/A
*
2
N/A
* The contents of this file are subject to the terms of the
2
N/A
* Common Development and Distribution License, Version 1.0 only
2
N/A
* (the "License"). You may not use this file except in compliance
2
N/A
* with the License.
2
N/A
*
2
N/A
* You can obtain a copy of the license at
usr
/
src
/
OPENSOLARIS.LICENSE
2
N/A
* or
http://www.opensolaris.org/os/licensing
.
2
N/A
* See the License for the specific language governing permissions
2
N/A
* and limitations under the License.
2
N/A
*
2
N/A
* When distributing Covered Code, include this CDDL HEADER in each
2
N/A
* file and include the License file at
usr
/
src
/
OPENSOLARIS.LICENSE
.
2
N/A
* If applicable, add the following below this CDDL HEADER, with the
2
N/A
* fields enclosed by brackets "[]" replaced with your own identifying
2
N/A
* information: Portions Copyright [yyyy] [name of copyright owner]
2
N/A
*
2
N/A
* CDDL HEADER END
2
N/A
*/
2
N/A
/*
2
N/A
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
2
N/A
* Use is subject to license terms.
2
N/A
*/
2
N/A
2
N/A
#
pragma
ident
"%Z%%M% %I% %E% SMI"
2
N/A
2
N/A
/*
2
N/A
* _X_cplx_lr_div(z, w) returns z / w computed by the textbook
2
N/A
* formula without regard to exceptions or special cases.
2
N/A
*
2
N/A
* This code is intended to be used only when CX_LIMITED_RANGE is
2
N/A
* ON; otherwise use _X_cplx_div.
2
N/A
*/
2
N/A
2
N/A
#
if
!
defined
(
i386
) && !
defined
(
__i386
) && !
defined
(
__amd64
)
2
N/A
#
error
This
code
is
for
x86
only
2
N/A
#
endif
2
N/A
2
N/A
long
double
_Complex
2
N/A
_X_cplx_lr_div
(
long
double
_Complex
z,
long
double
_Complex
w)
2
N/A
{
2
N/A
long
double
_Complex
v;
2
N/A
long
double
a, b, c, d, r;
2
N/A
2
N/A
a = ((
long
double
*)&z)[0];
2
N/A
b = ((
long
double
*)&z)[
1
];
2
N/A
c = ((
long
double
*)&w)[0];
2
N/A
d = ((
long
double
*)&w)[
1
];
2
N/A
r =
1.0f
/ (c * c + d * d);
2
N/A
((
long
double
*)&v)[0] = (a * c + b * d) * r;
2
N/A
((
long
double
*)&v)[
1
] = (b * c - a * d) * r;
2
N/A
return
(v);
2
N/A
}