Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Square Root

Reply
Thread Tools

Square Root

 
 
f2prateek
Guest
Posts: n/a
 
      01-17-2007
I need to calculate the roots of a quadratic equation by formula.But
how do I use the math.sqrt thing?

 
Reply With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      01-17-2007

f2prateek wrote:
> I need to calculate the roots of a quadratic equation by formula.But
> how do I use the math.sqrt thing?


Do a google search on java math.sqrt The first link will give you the
class definition which you can use. Basically, this should be in the
comp.lang.java.help newsgroup as it is pretty much rank beginner stuff,
and that group is more for people just getting started with java.

However, giving you the fish as well as teaching you to fish, code
like:

double a, b, c, root1, root2;
a = 1;
b = 4;
c = 7; //picked random numbers
root1 = ((-1 * b) + (Math.sqrt((b * b) - (4 * a * c))) / (2 * a);
root2 = ...

 
Reply With Quote
 
 
 
 
f2prateek
Guest
Posts: n/a
 
      01-17-2007
thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fix point square root Christian VHDL 5 03-18-2010 02:14 PM
Looking for Square Root Sign rfdjr1@optonline.net Computer Support 10 04-22-2009 02:03 PM
'big square root' for BigDecimal Jeremy Watts Java 4 05-26-2005 09:01 PM
SRT DIvision, Square root and reciprocal square root alghazo@siu.edu VHDL 0 05-27-2004 06:23 AM
Square Root of floating point number Luca VHDL 1 04-29-2004 02:51 PM



Advertisments