为什么Math.pow没有返回正确的值给我?

huangapple go评论79阅读模式
英文:

Why doesn't Math.pow return me the correct value?

问题

我正在尝试获取正确的值:

double poweredValue = Math.pow((1.1), (1 / 365));

使用我的科学计算器,我得到了 1.0002611578760678121616866817054。但是 Math.pow 返回了 1

如何获得完整的返回值?

英文:

I am trying to get the correct value for:

double poweredValue = Math.pow((1.1),(1 / 365));

Using my scientific calculator I get 1.0002611578760678121616866817054‬. But Math.pow returns a 1.

How do I get the full value returned?

答案1

得分: 1

double poweredValue = Math.pow((1.1), (1 / 365.0));
System.out.println(poweredValue);

输出结果 -
1.0002611578760678

英文:
double poweredValue = Math.pow((1.1),(1 / 365.0));
System.out.println(poweredValue);

Output -
1.0002611578760678

huangapple
  • 本文由 发表于 2020年3月15日 16:49:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/60691144.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定