The R Project SVN R

Rev

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

Rev 49744 Rev 51270
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996, 1997  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996, 1997  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 2000-6	    The R Development Core Team.
4
 *  Copyright (C) 2000-10	    The R Development Core Team.
5
 *  Copyright (C) 2005		    The R Foundation
5
 *  Copyright (C) 2005		    The R Foundation
6
 *
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  the Free Software Foundation; either version 2 of the License, or
Line 890... Line 890...
890
    PROTECT(x = CAR(args));
890
    PROTECT(x = CAR(args));
891
    n = length(x);
891
    n = length(x);
892
    PROTECT(y = allocVector(CPLXSXP, n));
892
    PROTECT(y = allocVector(CPLXSXP, n));
893
 
893
 
894
    switch (PRIMVAL(op)) {
894
    switch (PRIMVAL(op)) {
895
    case 10002: naflag = cmath1(z_atan, COMPLEX(x), COMPLEX(y), n); break;
-
 
896
    case 10003: naflag = cmath1(z_log, COMPLEX(x), COMPLEX(y), n); break;
895
    case 10003: naflag = cmath1(z_log, COMPLEX(x), COMPLEX(y), n); break;
897
 
896
 
898
    case 3: naflag = cmath1(z_sqrt, COMPLEX(x), COMPLEX(y), n); break;
897
    case 3: naflag = cmath1(z_sqrt, COMPLEX(x), COMPLEX(y), n); break;
899
 
898
 
900
    case 10: naflag = cmath1(z_exp, COMPLEX(x), COMPLEX(y), n); break;
899
    case 10: naflag = cmath1(z_exp, COMPLEX(x), COMPLEX(y), n); break;
Line 902... Line 901...
902
    case 20: naflag = cmath1(z_cos, COMPLEX(x), COMPLEX(y), n); break;
901
    case 20: naflag = cmath1(z_cos, COMPLEX(x), COMPLEX(y), n); break;
903
    case 21: naflag = cmath1(z_sin, COMPLEX(x), COMPLEX(y), n); break;
902
    case 21: naflag = cmath1(z_sin, COMPLEX(x), COMPLEX(y), n); break;
904
    case 22: naflag = cmath1(z_tan, COMPLEX(x), COMPLEX(y), n); break;
903
    case 22: naflag = cmath1(z_tan, COMPLEX(x), COMPLEX(y), n); break;
905
    case 23: naflag = cmath1(z_acos, COMPLEX(x), COMPLEX(y), n); break;
904
    case 23: naflag = cmath1(z_acos, COMPLEX(x), COMPLEX(y), n); break;
906
    case 24: naflag = cmath1(z_asin, COMPLEX(x), COMPLEX(y), n); break;
905
    case 24: naflag = cmath1(z_asin, COMPLEX(x), COMPLEX(y), n); break;
-
 
906
    case 25: naflag = cmath1(z_atan, COMPLEX(x), COMPLEX(y), n); break;
907
 
907
 
908
    case 30: naflag = cmath1(z_cosh, COMPLEX(x), COMPLEX(y), n); break;
908
    case 30: naflag = cmath1(z_cosh, COMPLEX(x), COMPLEX(y), n); break;
909
    case 31: naflag = cmath1(z_sinh, COMPLEX(x), COMPLEX(y), n); break;
909
    case 31: naflag = cmath1(z_sinh, COMPLEX(x), COMPLEX(y), n); break;
910
    case 32: naflag = cmath1(z_tanh, COMPLEX(x), COMPLEX(y), n); break;
910
    case 32: naflag = cmath1(z_tanh, COMPLEX(x), COMPLEX(y), n); break;
911
    case 33: naflag = cmath1(z_acosh, COMPLEX(x), COMPLEX(y), n); break;
911
    case 33: naflag = cmath1(z_acosh, COMPLEX(x), COMPLEX(y), n); break;
Line 983... Line 983...
983
    case 10001:
983
    case 10001:
984
	return cmath2(op, CAR(args), CADR(args), z_rround);
984
	return cmath2(op, CAR(args), CADR(args), z_rround);
985
    case 10002:
985
    case 10002:
986
	return cmath2(op, CAR(args), CADR(args), z_atan2);
986
	return cmath2(op, CAR(args), CADR(args), z_atan2);
987
    case 10003:
987
    case 10003:
-
 
988
    case 2: /* passed from do_log1arg */
-
 
989
    case 10:
988
	return cmath2(op, CAR(args), CADR(args), z_logbase);
990
	return cmath2(op, CAR(args), CADR(args), z_logbase);
989
    case 10004:
991
    case 10004:
990
	return cmath2(op, CAR(args), CADR(args), z_prec);
992
	return cmath2(op, CAR(args), CADR(args), z_prec);
991
    case 0:
993
    case 0:
992
	return cmath2(op, CAR(args), CADR(args), z_atan2);
994
	return cmath2(op, CAR(args), CADR(args), z_atan2);