Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
和 有什么好的替代Math.pow品Math.sqrt?我正在寻找更准确的东西。通常这些是足够准确的,但是当我通过我正在使用的算法加倍时,返回的值只是略微错误。我手工算了算,用java在算法里面一步步计算,发现问题出在Math.powandMath.sqrt方法的不准确上。
Math.pow
Math.sqrt
我在BigDecimal课堂上鬼混,但我不确定它在这里的用途。
BigDecimal
我重新检查了它,它的 Double 值太不精确了。BigDecimal 类是否有等效的数学方法?
您应该看一下这个答案,以使用 BigDescimal 提高 Math.pow 的准确性