I wanted to know if there is a function in java to find the antilogs or I would have to implement it myself? If so, how do I implement it?
Asked
Active
Viewed 6,047 times
3
-
Shouldn't `Math.pow` do this already for you? – Hovercraft Full Of Eels Mar 08 '15 at 03:56
-
Math.pow is not always accurate. I once raised 759 to the power 2 using Math.pow(), typecasting it to (long) and I got a wrong answer. I had to change the code to 759*759. – Piyush Ranjan Mar 08 '15 at 04:12
1 Answers
8
Math.exp(x)
returns ex.
Example:
public static void main(String[] args) {
System.out.println(Math.log(5)); // prints 1.6094...
System.out.println(Math.exp(1)); // prints 2.7182...
System.out.println(Math.exp(Math.log(5)); // prints 5.0000...
}

user253751
- 57,427
- 7
- 48
- 90