我这样转出错了
result = (float)(num_elect/sqrt(num_elect + num_apex_paddy));

解决方案 »

  1.   


    String a=String.valueOf(num_elect/sqrt(num_elect + num_apex_paddy));
    然后
    float b=Float.parseFloat(a);
      

  2.   

    复杂点的
    Double(d).floatValue() ------------------------------------------------------
               我们还年轻牛奶会有的奶牛也会有的 
                 可天天在 csdn 混这些会有吗 ??
      

  3.   

    我的程序是这样的:
      public float Calculate_power_factor(float number_electron,float number_apex_paddy){
          float result;
          double num_elect;
          double num_apex_paddy;
          double res;      num_elect = (double)number_electron;
          num_apex_paddy = (double)number_apex_paddy;      res = num_elect/sqrt(num_elect * num_elect + num_apex_paddy * num_apex_paddy);
     
          result = (float)res;

          return result;  
      }出错如下:
    C:\bea\user_projects\119\Alert\.wlnotdelete\DefaultWebApp_DefaultWebApp_4795646\jsp_servlet\__e_input_otherunits_electrodata.java:143: cannot resolve symbol
    probably occurred due to an error in /E_input_Otherunits_electrodata.jsp line 74:
    res = num_elect/sqrt(num_elect * num_elect + num_apex_paddy * num_apex_paddy);
      

  4.   

    我的程序是这样的:
      public float Calculate_power_factor(float number_electron,float number_apex_paddy){
          float result;
          double num_elect;
          double num_apex_paddy;
          double res;      num_elect = (double)number_electron;
          num_apex_paddy = (double)number_apex_paddy;      res = num_elect/sqrt(num_elect * num_elect + num_apex_paddy * num_apex_paddy);
     
          result = (float)res;

          return result;  
      }出错如下:
    C:\bea\user_projects\119\Alert\.wlnotdelete\DefaultWebApp_DefaultWebApp_4795646\jsp_servlet\__e_input_otherunits_electrodata.java:143: cannot resolve symbol
    probably occurred due to an error in /E_input_Otherunits_electrodata.jsp line 74:
    res = num_elect/sqrt(num_elect * num_elect + num_apex_paddy * num_apex_paddy);