我正在尝试将下面的行转换为 C#。 Dik、eint 和ratio 是变量。我不确定如何在 c# 和 modf 中表示 &a,如果我能得到指导,谢谢。
(void) modf (ratio * (dik / eint), &a);
最佳答案
I'm unsure how to represent &a in c# and modf if I can get guidance please and thank you.
您可以使用Math.Truncate
在 C# 中:
double a = Math.Truncate(ratio * dik / eint);
这将返回“指定 double float 的整数部分”,它与modf中返回的值相同。的 intpart
参数(您的 &a
)。
关于c# - 将 C 公式转换为 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21686160/