Help with this error: Operator '^' cannot be applied to operands of type 'double' and 'int'

I have the following C # code.

double a = 0;
 double d = 0;
double er = 0;
int N = numbers.Length;
a=(N*N/6) + N
d=(N-(N/2))*2



     for(int aa=1;aa<=data.length;aa++)
        {

              er=((10-aa)*(-a\) + d - (numbers[aa,12]))^2;

          }

numbers is a double array with this format:

1 0.3232 0.361 0.5214 0.233 -0.7678
2 0.3451 0.321 0.134 0.224 -0.706268
3 0.3123 0.351 0.155 0.523 -0.70626
4 0.36 0.312 0.216 0.233 -0.6453351
5 0.269 0.3331 0.162 0.224 -0.584962

but when running the code, I got this error in this line:

 er=((10-aa)*(-a\) + d - (numbers[aa,12]))^2;

Any help would be appreciated.

+3
source share
2 answers

Use Math.Pow- ^- this is not a power operator, it is a logical XOR operator .

There is no power operator in C #.

+12
source

, ^, C, ++ # xor. . , - Math.pow()

0

All Articles