File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
How do I square root a Double?
Joined: Jan 31, 2006
Feb 27, 2006 09:19:00
How come when I try and square root a Double I get the same answer?
Double VL = 2.0;
VL = Math.sqrt(VL);
System.out.println("VL =" + VL);
Why is the System output:
VL = 2.0
author and iconoclast
Joined: Jul 08, 2003
Feb 27, 2006 09:27:00
If you run that exact code in JDK 1.5.0 or later, it will print
In earlier versions of
it won't compile.
So there's some difference between the code you're showing us and the code you actually ran -- try putting just this code into an appropriate main() and running it; then try to figure out how your actual code is different.
[Jess in Action]
I agree. Here's the link:
subject: How do I square root a Double?
Error : Square root a Float
need help with string to double conversion
How to add main method to this, to check if it works.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015