Re: How to fix possible loss of precision
f2prateek wrote:
Hi again. Welcome to comp.lang.java.help!
Note that even here, folks are expected to put some
work in, themselves, so I will make one point..
My program is:
Not indented. When you post code to usenet,
please replace any tabs with 2 or 3 spaces, but
ensure the code is indented.
Something like this..
//program to find the roots of a quadratic eqaution
public class quadratic_roots
{
int r1,r2;
public void accept(int a,int b,int c)
{
r1=-b/(2*a)+(Math.sqrt(b*b-4*(a*c)))/(2*a);
r2=-b/(2*a)-(Math.sqrt(b*b-4*(a*c)))/(2*a);
System.out.println(r1+" , "+r2);
}
}
...indenting code makes it much easier for
someone to read, and you would not want
to make it *hard* for us to read, would you?
Now - I have not addressed your latest problem
yet, because there are a few things I want to
clarify first.
1) Have you found the JavaDocs and Java Tutorial?
(Put the links you found..)
2) Why are you still importing the java.io package
in your code? As others had mentioned on the
thread on comp.lang.java.programmer, it is not
needed for this program.
Andrew T.