Reputation: 259
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 on this line:
er=((10-aa)*(-a\) + d - (numbers[aa,12]))^2;
any help would be appreciated.
Upvotes: 3
Views: 2739
Reputation: 17732
I'm not sure what you're intending to use the ^
operator for, but in C,C++, and C# it is the xor
operator. Its not defined for non-integral types. If youre trying to do an exponential, you're better off using something like Math.pow() or doing the multiplication yourself
Upvotes: 0
Reputation: 499002
Use Math.Pow
- the ^
is not the power operator, it is a logical XOR operator.
There is no power operator in c#.
Upvotes: 13