If I understand you correctly why not leave b as positive? As you are squaring it anyway it seems odd.

You could also calculate the fixed stuff. Assuming b is just the numeric value entered into the textbox:

Code:

if (b >= -6 && b <= -20)
{
d=b*b-(4*0.2253*-194.4); //calculate 4*0.2253*-194.4 in advance here
}
else if (b >= 21 && b <= 52)
{
d=b*b-(4*0.2253*-134.4);
}
else if (b > 52)
{
d= (b*4.635);
}

--

Joe