Reputation: 17761
the Javadoc of java.lang.Math.pow(double a, double b) states:
This means a call to Math.pow(-Math.E,-1.1d)
yields NaN.
Why isn't Math.pow() returning the inverse 1/e^1.1
? Is there an error in my reasoning?
Thanks!
Upvotes: 1
Views: 805
Reputation: 34900
Yes, why it should return 1/e^1.1
? This will be 1/(-e)^1.1
which is not real number.
Upvotes: 1
Reputation: 308763
Yes, there's an issue with your logic. Please go and read about complex numbers.
The problem is that a negative base raised to a non-integer negative power results in a complex number, not a real double. There's an imaginary part that Math.pow
can't deal with.
Upvotes: 10