From: Christian Pohlmann Date: 2007-01-06T01:13:28+09:00 Subject: Re: Problem solving quadratic equations Hi, On 1/5/07, Jay Bornhoft wrote: > I wrote a small program to solve for x using the quadratic formula but > instead of receiving a + and - result I am getting two identical > answers... > > Is the problem with my math or with my code? I don't know for which values you tested your code, but if the discriminent (term which you apply sqrt to) equals 0, your equation only has *one* solution. That's why you get two identical values. Btw: You should check for a negative discriminent (that happens if your equation isn't solvable at all) Cheers, Christian