You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
448 B

package cn.edu.gxu;
public class LogFunction
{
public static double Calculate(String s)
{
String[] parameters=new String[2];
parameters=s.split(" ");//用空格切分传过来的两个数字
float a=Float.parseFloat(parameters[0]);
float b=Float.parseFloat(parameters[1]);
double result=Math.log(b)/Math.log(a); //log 都是用e为底还要用个换底公式OvO
return result;
}
}