I'm finding a logarithm of value 1 which is equal to 0 not 0.0. When user enter any point values then it give exact answer. But the problem is Which Value Does Not Consist in points it give the answer of those value in points.I try parsing and Typecasting but nothing happen.Is there a function in
Java which can Stop This.
This is my Code.
public class New {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double num = 0;
double result;
System.out.print("Value:");
num = s.nextDouble();
result = Math.log(num);
System.out.print("Answer:"+result);
}
}
Compiler Output:
Value:1
Answer:0.0