View | Details | Raw Unified | Return to bug 221341 | Differences between
and this patch

Collapse All | Expand All

(-)lib/msun/Makefile (-1 / +4 lines)
Lines 79-85 Link Here
79
	s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \
79
	s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \
80
	s_signgam.c s_significand.c s_significandf.c s_sin.c s_sinf.c \
80
	s_signgam.c s_significand.c s_significandf.c s_sin.c s_sinf.c \
81
	s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_tgammaf.c s_trunc.c s_truncf.c \
81
	s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_tgammaf.c s_trunc.c s_truncf.c \
82
	w_cabs.c w_cabsf.c w_drem.c w_dremf.c
82
	w_cabs.c w_cabsf.c w_drem.c w_dremf.c \
83
	s_cpowf.c s_cpowl.c s_cpow.c \
84
	s_clog.c s_clogf.c s_clogl.c
83
85
84
# Location of fpmath.h and _fpmath.h
86
# Location of fpmath.h and _fpmath.h
85
.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})
87
.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})
Lines 221-226 Link Here
221
MLINKS+=tan.3 tanf.3 tan.3 tanl.3
223
MLINKS+=tan.3 tanf.3 tan.3 tanl.3
222
MLINKS+=tanh.3 tanhf.3 tanh.3 tanhl.3
224
MLINKS+=tanh.3 tanhf.3 tanh.3 tanhl.3
223
MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3
225
MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3
226
MLINKS+=clog.3 cpow.3
224
227
225
.include <src.opts.mk>
228
.include <src.opts.mk>
226
229
(-)lib/msun/man/clog.3 (+73 lines)
Line 0 Link Here
1
.\"	$OpenBSD: clog.3,v 1.2 2013/06/05 03:40:26 tedu Exp $
2
.\"
3
.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
4
.\"
5
.\" Permission to use, copy, modify, and distribute this software for any
6
.\" purpose with or without fee is hereby granted, provided that the above
7
.\" copyright notice and this permission notice appear in all copies.
8
.\"
9
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
.\"
17
.Dd $Mdocdate: June 5 2013 $
18
.Dt CLOG 3
19
.Os
20
.Sh NAME
21
.Nm clog ,
22
.Nm clogf ,
23
.Nm clogl
24
.Nd complex natural logarithm
25
.Sh SYNOPSIS
26
.In complex.h
27
.Ft double complex
28
.Fn clog "double complex z"
29
.Ft float complex
30
.Fn clogf "float complex z"
31
.Ft long double complex
32
.Fn clogl "long double complex z"
33
.Sh DESCRIPTION
34
The
35
.Fn clog ,
36
.Fn clogf
37
and
38
.Fn clogl
39
functions compute the complex logarithm to the base
40
.Ms e
41
(2.718...) of
42
.Fa z .
43
.Pp
44
If
45
.Fa z
46
= x + iy, then
47
.Bd -literal -offset indent
48
clog(z) = log(sqrt(x^2 + y^2)) + i atan(y / x).
49
.Ed
50
.Sh RETURN VALUES
51
The
52
.Fn clog ,
53
.Fn clogf
54
and
55
.Fn clogl
56
functions return the complex logarithm to the base
57
.Ms e
58
of
59
.Fa z
60
with imaginary part in the interval
61
.Bq -Pi, Pi ,
62
and unbounded real part.
63
.Sh SEE ALSO
64
.Xr cexp 3 ,
65
.Xr cpow 3
66
.Sh STANDARDS
67
The
68
.Fn clog ,
69
.Fn clogf
70
and
71
.Fn clogl
72
functions conform to
73
.St -isoC-99 .
(-)lib/msun/man/complex.3 (-6 lines)
Lines 116-124 Link Here
116
.In complex.h
116
.In complex.h
117
functions described here conform to
117
functions described here conform to
118
.St -isoC-99 .
118
.St -isoC-99 .
119
.Sh BUGS
120
The logarithmic functions
121
.Fn clog
122
and the power functions
123
.Fn cpow
124
are not implemented.
(-)lib/msun/man/cpow.3 (+64 lines)
Line 0 Link Here
1
.\"	$OpenBSD: cpow.3,v 1.3 2013/06/05 03:40:26 tedu Exp $
2
.\"
3
.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
4
.\"
5
.\" Permission to use, copy, modify, and distribute this software for any
6
.\" purpose with or without fee is hereby granted, provided that the above
7
.\" copyright notice and this permission notice appear in all copies.
8
.\"
9
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
.\"
17
.Dd $Mdocdate: June 5 2013 $
18
.Dt CPOW 3
19
.Os
20
.Sh NAME
21
.Nm cpow ,
22
.Nm cpowf ,
23
.Nm cpowl
24
.Nd complex power functions
25
.Sh SYNOPSIS
26
.In complex.h
27
.Ft double complex
28
.Fn cpow "double complex x" "double complex z"
29
.Ft float complex
30
.Fn cpowf "float complex x" "float complex z"
31
.Ft long double complex
32
.Fn cpowl "long double complex x" "long double complex z"
33
.Sh DESCRIPTION
34
The
35
.Fn cpow ,
36
.Fn cpowf
37
and
38
.Fn cpowl
39
functions compute the complex number
40
.Fa x
41
raised to the complex power
42
.Fa z ,
43
with a branch cut along the negative real axis for the first argument.
44
.Sh RETURN VALUES
45
The
46
.Fn cpow ,
47
.Fn cpowf
48
and
49
.Fn cpowl
50
functions return the complex number
51
.Fa x
52
raised to the complex power
53
.Fa z .
54
.Sh SEE ALSO
55
.Xr cexp 3 ,
56
.Xr clog 3
57
.Sh STANDARDS
58
The
59
.Fn cpow ,
60
.Fn cpowf
61
and
62
.Fn cpowl
63
functions conform to
64
.St -isoC-99 .
(-)lib/msun/src/s_clog.c (+73 lines)
Line 0 Link Here
1
/*	$OpenBSD: s_clog.c,v 1.7 2016/09/12 19:47:02 guenther Exp $	*/
2
/*
3
 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
18
/*							clog.c
19
 *
20
 *	Complex natural logarithm
21
 *
22
 *
23
 *
24
 * SYNOPSIS:
25
 *
26
 * double complex clog();
27
 * double complex z, w;
28
 *
29
 * w = clog (z);
30
 *
31
 *
32
 *
33
 * DESCRIPTION:
34
 *
35
 * Returns complex logarithm to the base e (2.718...) of
36
 * the complex argument x.
37
 *
38
 * If z = x + iy, r = sqrt( x**2 + y**2 ),
39
 * then
40
 *       w = log(r) + i arctan(y/x).
41
 * 
42
 * The arctangent ranges from -PI to +PI.
43
 *
44
 *
45
 * ACCURACY:
46
 *
47
 *                      Relative error:
48
 * arithmetic   domain     # trials      peak         rms
49
 *    DEC       -10,+10      7000       8.5e-17     1.9e-17
50
 *    IEEE      -10,+10     30000       5.0e-15     1.1e-16
51
 *
52
 * Larger relative error can be observed for z near 1 +i0.
53
 * In IEEE arithmetic the peak absolute error is 5.2e-16, rms
54
 * absolute error 1.0e-16.
55
 */
56
57
#include <complex.h>
58
#include <float.h>
59
#include <math.h>
60
61
double complex
62
clog(double complex z)
63
{
64
	double complex w;
65
	double p, rr;
66
67
	/*rr = sqrt( z->r * z->r  +  z->i * z->i );*/
68
	rr = cabs(z);
69
	p = log(rr);
70
	rr = atan2 (cimag (z), creal (z));
71
	w = p + rr * I;
72
	return (w);
73
}
(-)lib/msun/src/s_clogf.c (+72 lines)
Line 0 Link Here
1
/*	$OpenBSD: s_clogf.c,v 1.3 2016/09/12 19:47:02 guenther Exp $	*/
2
/*
3
 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
18
/*							clogf.c
19
 *
20
 *	Complex natural logarithm
21
 *
22
 *
23
 *
24
 * SYNOPSIS:
25
 *
26
 * void clogf();
27
 * cmplxf z, w;
28
 *
29
 * clogf( &z, &w );
30
 *
31
 *
32
 *
33
 * DESCRIPTION:
34
 *
35
 * Returns complex logarithm to the base e (2.718...) of
36
 * the complex argument x.
37
 *
38
 * If z = x + iy, r = sqrt( x**2 + y**2 ),
39
 * then
40
 *       w = log(r) + i arctan(y/x).
41
 *
42
 * The arctangent ranges from -PI to +PI.
43
 *
44
 *
45
 * ACCURACY:
46
 *
47
 *                      Relative error:
48
 * arithmetic   domain     # trials      peak         rms
49
 *    IEEE      -10,+10     30000       1.9e-6       6.2e-8
50
 *
51
 * Larger relative error can be observed for z near 1 +i0.
52
 * In IEEE arithmetic the peak absolute error is 3.1e-7.
53
 *
54
 */
55
56
#include <complex.h>
57
#include <math.h>
58
59
float complex
60
clogf(float complex z)
61
{
62
	float complex w;
63
	float p, rr, x, y;
64
65
	x = crealf(z);
66
	y = cimagf(z);
67
	rr = atan2f(y, x);
68
	p = cabsf(z);
69
	p = logf(p);
70
	w = p + rr * I;
71
	return (w);
72
}
(-)lib/msun/src/s_clogl.c (+73 lines)
Line 0 Link Here
1
/*	$OpenBSD: s_clogl.c,v 1.3 2016/09/12 19:47:02 guenther Exp $	*/
2
3
/*
4
 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
5
 *
6
 * Permission to use, copy, modify, and distribute this software for any
7
 * purpose with or without fee is hereby granted, provided that the above
8
 * copyright notice and this permission notice appear in all copies.
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
 */
18
19
/*							clogl.c
20
 *
21
 *	Complex natural logarithm
22
 *
23
 *
24
 *
25
 * SYNOPSIS:
26
 *
27
 * long double complex clogl();
28
 * long double complex z, w;
29
 *
30
 * w = clogl( z );
31
 *
32
 *
33
 *
34
 * DESCRIPTION:
35
 *
36
 * Returns complex logarithm to the base e (2.718...) of
37
 * the complex argument x.
38
 *
39
 * If z = x + iy, r = sqrt( x**2 + y**2 ),
40
 * then
41
 *       w = log(r) + i arctan(y/x).
42
 *
43
 * The arctangent ranges from -PI to +PI.
44
 *
45
 *
46
 * ACCURACY:
47
 *
48
 *                      Relative error:
49
 * arithmetic   domain     # trials      peak         rms
50
 *    DEC       -10,+10      7000       8.5e-17     1.9e-17
51
 *    IEEE      -10,+10     30000       5.0e-15     1.1e-16
52
 *
53
 * Larger relative error can be observed for z near 1 +i0.
54
 * In IEEE arithmetic the peak absolute error is 5.2e-16, rms
55
 * absolute error 1.0e-16.
56
 */
57
58
#include <complex.h>
59
#include <math.h>
60
61
long double complex
62
clogl(long double complex z)
63
{
64
	long double complex w;
65
	long double p, rr;
66
67
	/*rr = sqrt(z->r * z->r  +  z->i * z->i);*/
68
	p = cabsl(z);
69
	p = logl(p);
70
	rr = atan2l(cimagl(z), creall(z));
71
	w = p + rr * I;
72
	return (w);
73
}
(-)lib/msun/src/s_cpow.c (+72 lines)
Line 0 Link Here
1
/*	$OpenBSD: s_cpow.c,v 1.7 2016/09/12 19:47:02 guenther Exp $	*/
2
/*
3
 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
18
/*							cpow
19
 *
20
 *	Complex power function
21
 *
22
 *
23
 *
24
 * SYNOPSIS:
25
 *
26
 * double complex cpow();
27
 * double complex a, z, w;
28
 *
29
 * w = cpow (a, z);
30
 *
31
 *
32
 *
33
 * DESCRIPTION:
34
 *
35
 * Raises complex A to the complex Zth power.
36
 * Definition is per AMS55 # 4.2.8,
37
 * analytically equivalent to cpow(a,z) = cexp(z clog(a)).
38
 *
39
 * ACCURACY:
40
 *
41
 *                      Relative error:
42
 * arithmetic   domain     # trials      peak         rms
43
 *    IEEE      -10,+10     30000       9.4e-15     1.5e-15
44
 *
45
 */
46
47
#include <complex.h>
48
#include <float.h>
49
#include <math.h>
50
51
double complex
52
cpow(double complex a, double complex z)
53
{
54
	double complex w;
55
	double x, y, r, theta, absa, arga;
56
57
	x = creal (z);
58
	y = cimag (z);
59
	absa = cabs (a);
60
	if (absa == 0.0) {
61
		return (0.0 + 0.0 * I);
62
	}
63
	arga = carg (a);
64
	r = pow (absa, x);
65
	theta = x * arga;
66
	if (y != 0.0) {
67
		r = r * exp (-y * arga);
68
		theta = theta + y * log (absa);
69
	}
70
	w = r * cos (theta) + (r * sin (theta)) * I;
71
	return (w);
72
}
(-)lib/msun/src/s_cpowf.c (+71 lines)
Line 0 Link Here
1
/*	$OpenBSD: s_cpowf.c,v 1.2 2010/07/18 18:42:26 guenther Exp $	*/
2
/*
3
 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
18
/*							cpowf
19
 *
20
 *	Complex power function
21
 *
22
 *
23
 *
24
 * SYNOPSIS:
25
 *
26
 * float complex cpowf();
27
 * float complex a, z, w;
28
 *
29
 * w = cpowf (a, z);
30
 *
31
 *
32
 *
33
 * DESCRIPTION:
34
 *
35
 * Raises complex A to the complex Zth power.
36
 * Definition is per AMS55 # 4.2.8,
37
 * analytically equivalent to cpow(a,z) = cexp(z clog(a)).
38
 *
39
 * ACCURACY:
40
 *
41
 *                      Relative error:
42
 * arithmetic   domain     # trials      peak         rms
43
 *    IEEE      -10,+10     30000       9.4e-15     1.5e-15
44
 *
45
 */
46
47
#include <complex.h>
48
#include <math.h>
49
50
float complex
51
cpowf(float complex a, float complex z)
52
{
53
	float complex w;
54
	float x, y, r, theta, absa, arga;
55
56
	x = crealf(z);
57
	y = cimagf(z);
58
	absa = cabsf (a);
59
	if (absa == 0.0f) {
60
		return (0.0f + 0.0f * I);
61
	}
62
	arga = cargf (a);
63
	r = powf (absa, x);
64
	theta = x * arga;
65
	if (y != 0.0f) {
66
		r = r * expf (-y * arga);
67
		theta = theta + y * logf (absa);
68
	}
69
	w = r * cosf (theta) + (r * sinf (theta)) * I;
70
	return (w);
71
}
(-)lib/msun/src/s_cpowl.c (+72 lines)
Line 0 Link Here
1
/*	$OpenBSD: s_cpowl.c,v 1.2 2011/07/20 19:28:33 martynas Exp $	*/
2
3
/*
4
 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
5
 *
6
 * Permission to use, copy, modify, and distribute this software for any
7
 * purpose with or without fee is hereby granted, provided that the above
8
 * copyright notice and this permission notice appear in all copies.
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
 */
18
19
/*							cpowl
20
 *
21
 *	Complex power function
22
 *
23
 *
24
 *
25
 * SYNOPSIS:
26
 *
27
 * long double complex cpowl();
28
 * long double complex a, z, w;
29
 *
30
 * w = cpowl (a, z);
31
 *
32
 *
33
 *
34
 * DESCRIPTION:
35
 *
36
 * Raises complex A to the complex Zth power.
37
 * Definition is per AMS55 # 4.2.8,
38
 * analytically equivalent to cpow(a,z) = cexp(z clog(a)).
39
 *
40
 * ACCURACY:
41
 *
42
 *                      Relative error:
43
 * arithmetic   domain     # trials      peak         rms
44
 *    IEEE      -10,+10     30000       9.4e-15     1.5e-15
45
 *
46
 */
47
48
#include <complex.h>
49
#include <math.h>
50
51
long double complex
52
cpowl(long double complex a, long double complex z)
53
{
54
	long double complex w;
55
	long double x, y, r, theta, absa, arga;
56
57
	x = creall(z);
58
	y = cimagl(z);
59
	absa = cabsl(a);
60
	if (absa == 0.0L) {
61
		return (0.0L + 0.0L * I);
62
	}
63
	arga = cargl(a);
64
	r = powl(absa, x);
65
	theta = x * arga;
66
	if (y != 0.0L) {
67
		r = r * expl(-y * arga);
68
		theta = theta + y * logl(absa);
69
	}
70
	w = r * cosl(theta) + (r * sinl(theta)) * I;
71
	return (w);
72
}
(-)lib/msun/Symbol.map (+6 lines)
Lines 279-284 Link Here
279
	/* Implemented as weak aliases for imprecise versions */
279
	/* Implemented as weak aliases for imprecise versions */
280
	powl;
280
	powl;
281
	tgammal;
281
	tgammal;
282
	cpow;
283
	cpowf;
284
	cpowl;
285
	clog;
286
	clogf;
287
	clogl;
282
};
288
};
283
289
284
/* First added in 11.0-CURRENT */
290
/* First added in 11.0-CURRENT */

Return to bug 221341