[英]How can I produce the exact decimal values
Code:代码:
Dim mp as Decimal将 mp 调暗为十进制
mp = 2056834 / 36 MsgBox(mp, vbInformation) mp = 2056834 / 36 MsgBox(mp, vbInformation)
Output: 57134.2777777778 Output:57134.2777777778
I was expecting the output to be:我期待 output 是:
Output: 57134.27777777778 Output:57134.27777777778
What suppose to be the problem on why it was short of a decimal point?为什么它缺少小数点应该是什么问题?
Try this:尝试这个:
Dim mp As Decimal
mp = Math.Round(CDec(2056834) / CDec(36), 11)
MsgBox(mp, vbInformation)
This will produce the expected output: 57134.27777777778
这将产生预期的 output:
57134.27777777778
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.