VBScript:将精度扩展到16位小数以规避科学计数法吗? [英] VBScript: Expanding precision to 16 decimals to circumvent scientific notation?
问题描述
我已经搜索了这个答案,但是找不到VBS的任何内容.
I've searched for this answer but cannot find anything for VBS.
例如:
dim num
num = 1234567890123456 'a 16 digit number
msgbox num
以任何方式使用num
都会导致数字以科学计数法显示.
Working with num
in any way will result in the number being displayed in scientific notation.
如何避免这种情况?
推荐答案
由于Int
和Long
都不能存储该数字,因此VBScript将16位数字更改为Double
.您可以使用 FormatNumber 函数将其显示为整数:>
The 16 digit number is changed to a Double
by VBScript because neither Int
, nor Long
can store that number. You can use the FormatNumber function to display it as an integer:
FormatNumber(Expression,NumDigitsAfterDecimal,IncludeLeadingDigit, UseParensForNegativeNumbers,GroupDigit)
FormatNumber(Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigit)
num = 1234567890123456
msgbox FormatNumber(num, 0, -2, -2, false)
这篇关于VBScript:将精度扩展到16位小数以规避科学计数法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!