I have this code:
private void t_Tick(object source, EventArgs e)
{
double anInteger;
anInteger = Convert.ToDouble(label1.Text);
anInteger = double.Parse(label1.Text);
double val1;
double val2;
double answer;
double previous_val;
previous_val = Convert.ToDouble(label1.Text);
previous_val = double.Parse(label1.Text);
val1 = anInteger;
val2 = ((((((previous_val ^ 1.001)) / 24) - ((previous_val / 24) / 60)) / 10));
answer = val1 + val2;
label1.Text = answer.ToString();
}
I am getting the error "Operator '^' cannot be applied to operands of type 'double' and 'double'" at the line:
val2 = ((((((previous_val ^ 1.001)) / 24) - ((previous_val / 24) / 60)) / 10));
Does anyone have any solutions?
Math.Pow(previous_val, 1.001);
will solve your problem. this is the way how to use powers with double.
^ is bitwise operator XOR. It makes no sense on double type.
What was your intent?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With