我正在使用 emscripten 将 c++ 编译为 WASM,但一次只能对一个文件执行此操作。我不想将整个项目和库放在一个文件中,但我还没有找到有关如何正确编译它的任何信息。
我正在使用它的泰勒近似来编写Java中正弦函数的递归定义,但是noSuchMethodException在运行代码时.这是我到目前为止所拥有的:
public static void Main(String[] args){
System.out.println("The approximate sine of pi over 2 with an accuracy index of ten is:");
System.out.println(Mathematics.recursiveSine(Math.PI/2,10));
}
public static double recursiveSine(double value, int index){
if(index==1) {
return value;
}
return ((double) ((-1)^(2*index + 1)) * Math.pow(value,2*index + 1)/factorial(2*index + 1)) + recursiveSine(value, index-1);
}
public static int factorial(int value){
return value==1 ? value : value*factorial(value-1);
}
Run Code Online (Sandbox Code Playgroud)