计算a^b,其中b是c#中的负指数
例如,我尝试在 C# 中计算 9704−36。 我该怎么做呢? 我正在使用 Visual C# 2010 Express
For example I am trying to calculate 9704−36 in C#.
How should i go about doing this?
I am using Visual C# 2010 Express
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Math.Pow(9704, -36)。 C# 没有专用的求幂运算符和
Math.Pow
填补了空白。Use
Math.Pow(9704, -36)
. C# does not have a dedicated exponentiation operator andMath.Pow
fills the gap.与计算正指数的方式完全相同:
C# 中没有幂运算符(
^
是异或,而不是幂),因此您需要使用 Math.Pow 函数。Exactly the same way you do it for a positive exponent:
There is no power operator in C# (
^
is exclusive or, not power), so you need to use the Math.Pow function.