【发布时间】:2018-12-22 07:49:48
【问题描述】:
import java.lang.*;
import java.math.*;
public class GFG {
public static void main(String[] args) {
// Creating a BigInteger object
BigInteger big;
big = new BigInteger("31739");
BigInteger res =big.sqrt();
// print result
System.out.println("Square root value of BigInteger " + big
+ " is " + res);
}
}
在BigInteger 中找不到符号sqrt()
请帮帮我!!!!!!
【问题讨论】:
-
以上代码将在 Java 9 上运行。检查 Java9 文档中的 sqrt() 方法:docs.oracle.com/javase/9/docs/api/java/math/…
-
没有一个答案似乎知道 Brent 和 Zimmermann 的 "Modern Computer Arithmetic" 的极快(特别是对于 256 位或更大的 BigIntegers)算法 1.12。尝试一下。我在我的 Delphi BigInteger 库中实现了它,它比这里显示的任何东西都要快。
标签: java biginteger sqrt