问题: 为什么我的float ^ float变成复数? 在Wolfram Alpha中,答案应该是-0.937
import numpy as np
import math
implied_cost = -0.712589074
max_profit = 1.662707838
max_loss = -28.02850356
a = math.log(abs(implied_cost))
b = abs(max_profit/max_loss)
new_score = a**b
print(a)
print(type(a))
print(b)
print(type(b))
print(new_score)
print(type(new_score))
output:
-0.33885035851284695
<class 'float'>
0.05932203388742028
<class 'float'>
(0.9215800307441395+0.17376732129409583j)
<class 'complex'>
问题: 为什么我的float ^ float变成复数? 在Wolfram Alpha中,答案应该是-0.937