c# - One of the parameters of a binary operator must be the containing type -


got error 1 of parameters of binary operator must containing type

can not see wrong operator overloadin

error @ public static complex operator +(complex c1, complex c2)

namespace testcomplex {     class program     {          public static complex operator +(complex c1, complex c2)         {             return new complex(c1.real + c2.real, c1.imaginary + c2.imaginary);         }          public static complex operator /(complex c1, complex c2)         {             return new complex(c1.real / c2.real, c1.imaginary / c2.imaginary);         }          public static complex operator *(complex c1, complex c2)         {             return new complex(c1.real * c2.real, c1.imaginary * c2.imaginary + c1.real * c2.imaginary + c2.real * c1.imaginary);         }         public static complex operator -(complex c1, complex c2)         {             return new complex(c1.real - c2.real, c1.imaginary - c2.imaginary);         }          //public static complex sqrt -(complex c1, complex c2)         //{             //return new complex(c1.real - c2.real, c1.imaginary - c2.imaginary);         //}         static void main(string[] args)         {             complex = new complex(0.5,0);             complex b = new complex(0.6,0);              //complex aa = math.exp(-(1 / 4) * * (b / + math.sqrt(-7 * math.pow(b, 2) / math.pow(a, 2))) / b + (1 / 4) * b * (a / b + math.sqrt(-7 * math.pow(a, 2) / math.pow(b, 2))) / a);             //jesus[i] = aa.real;              complex aa = complex.exp(-(1 / 4) * * (b / + complex.sqrt(-7 * complex.pow(b, 2) / complex.pow(a, 2))) / b + (1 / 4) * b * (a / b + complex.sqrt(-7 * complex.pow(a, 2) / complex.pow(b, 2))) / a);             console.writeline(aa.real);             console.writeline(aa.imaginary);             console.readkey();         }     } } 

here doc on complex structure in c#, there part explaining why might getting nan

you doing divisions might dividing zero, need debug equation further, recommend checking outside of c# values give nan


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -