VBScript:将精度扩展到16位小数以规避科学计数法吗? [英] VBScript: Expanding precision to 16 decimals to circumvent scientific notation?

查看:272
本文介绍了VBScript:将精度扩展到16位小数以规避科学计数法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了这个答案,但是找不到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.

如何避免这种情况?

推荐答案

由于IntLong都不能存储该数字,因此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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆