我写了如下语句:
for(i=0;i<8;i++)
{
Net[0][i]=X[i];
O[0][i]=1.0/(1+exp(-(Net[0][i]-Theta[0][i])));
}
编译后出现如下错误;请高手指教是怎么回事
E:\java\neural>javac Neural.java
Neural.java:114: cannot resolve symbol
symbol : method exp (double)
location: class NeuralActionListener
O[0][i]=1.0/(1+exp(-(Net[0][i]-Theta[0][i])));
^
Neural.java:114: operator / cannot be applied to float,java.lang.Strin
O[0][i]=1.0/(1+exp(-(Net[0][i]-Theta[0][i])));
^
2 errors
----------------解决方案--------------------------------------------------------
把类型强制转换以下就好了
----------------解决方案--------------------------------------------------------
怎么转?exp的操作数是不是不能为double型的?
----------------解决方案--------------------------------------------------------
我写了一个类:
double f(double num1,double num2)
{
return(1.0/(1+exp(num2-num1)));
}
出现错误:
E:\java\neural>javac Neural.java
Neural.java:161: cannot resolve symbol
symbol : method exp (double)
location: class NeuralActionListener
return(1.0/(1+exp(num2-num1)));
^
Neural.java:161: operator / cannot be applied to double,java.lang.String
return(1.0/(1+exp(num2-num1)));
^
2 errors
想不明白啊?
----------------解决方案--------------------------------------------------------