The R Project SVN R

Rev

Rev 49062 | Rev 49744 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 49062 Rev 49066
Line 110... Line 110...
110
#ifndef HAVE_C99_COMPLEX
110
#ifndef HAVE_C99_COMPLEX
111
 
111
 
112
/* "export" this (to be API) : */
112
/* "export" this (to be API) : */
113
void R_cpow_n(Rcomplex *r, Rcomplex *x, int k) {
113
void R_cpow_n(Rcomplex *r, Rcomplex *x, int k) {
114
    if(k == 0) {
114
    if(k == 0) {
115
	r->r = x->r;
115
	r->r = 1.;
116
	r->i = x->i;
116
	r->i = 0.;
117
    } else if(k < 0) {
117
    } else if(k < 0) {
118
	Rcomplex h;
118
	Rcomplex h;
119
	R_cpow_n(r, x, -k);
119
	R_cpow_n(r, x, -k);
120
	/* r := 1/r : */
120
	/* r := 1/r : */
121
	h.r = 1.; h.i = 0;
121
	h.r = 1.; h.i = 0;
Line 186... Line 186...
186
 
186
 
187
 
187
 
188
/* "export" this (to be API) : */
188
/* "export" this (to be API) : */
189
double complex R_cpow_n(double complex X, int k) {
189
double complex R_cpow_n(double complex X, int k) {
190
    if(k == 0)
190
    if(k == 0)
191
	return X;
191
	return (double complex) 1.;
192
    else if(k < 0)
192
    else if(k < 0)
193
	return 1. / R_cpow_n(X, -k);
193
	return 1. / R_cpow_n(X, -k);
194
    else {/* k > 0 */
194
    else {/* k > 0 */
195
	double complex z = X;
195
	double complex z = X;
196
	k--;
196
	k--;