## Re:Re: What's wrong with this

OK, sorry..

this is an equation.... I am trying to find the value of s, therefore, s

should equal 3.86 times the square root of r times the sum of f + or - e.

The values are provided by the user.

Example, when I input r = 250 and f = .70 and e = .03 I get 52.11. When I

input e as a negative number it still adds instead of subtracts and I still

get 52.11. Everything works fine except it won't subtract the value of e if

user inputs a negative number.

Equation looks something like s = 3.86*sqrt r(f +- e)

Thanks again,

Aaron

PS - This is an equation that accident reconstructionists use to find the

critical speed of a yaw.

"Chris Uzdavinis (TeamB)" <

XXXX@XXXXX.COM >wrote in message

##### Quote

"Aaron" < XXXX@XXXXX.COM >writes:

>void __fastcall TForm6::Button1Click(TObject *Sender)

>{

>r = StrToFloat(Edit1 ->Text);

>f = StrToFloat(Edit2 ->Text);

>e = StrToFloat(Edit3 ->Text);

>if (e>=0)

>{s = 3.86*sqrt(r*(f+e));}

>else

>{s = 3.86*sqrt(r*(f-e));}

>Edit4 ->Text = FormatFloat("0.0000",s);

>}

>

>It will add e but it won't subtract.

>Any help appreciated,

Please give examples of what the data is in the Edit1..3, what your

expected result is, what the values of r, f, e are, and what actually

resulted.

--

Chris (TeamB);