Private Function CInt64ToCitect(ByVal Int64 As Currency) As Long
Const Int64ToCitectOffset As Currency = 11644473600@
CInt64ToCitect = (Int64 / 1000) - Int64ToCitectOffset
End Function(Int64 / 1000) - Int64ToCitectOffset,这个表达式算出来还很大吧,放不到一个long里面吧
谁能具体给我解释一下Currency ,它和整型,浮点型有什么关系,11644473600是不是和一个同样值得整型相当
Const Int64ToCitectOffset As Currency = 11644473600@
CInt64ToCitect = (Int64 / 1000) - Int64ToCitectOffset
End Function(Int64 / 1000) - Int64ToCitectOffset,这个表达式算出来还很大吧,放不到一个long里面吧
谁能具体给我解释一下Currency ,它和整型,浮点型有什么关系,11644473600是不是和一个同样值得整型相当
c = 919999999999991#
Debug.Print c最大值大约在这个数附近。
Dim c As Currency, l As Long
c = 2 ^ 49 + 2 ^ 48 + 2 ^ 46 + 2 ^ 42 + 2 ^ 41 + 2 ^ 39 + 2 ^ 38 + 2 ^ 36 + 2 ^ 35 + 2 ^ 34
' 919999999999991#
Debug.Print c
l = 2 ^ 30
Debug.Print l
'Debug.Print CInt64ToCitect(1)
End Sub
l = 2 ^ 30
Debug.Print l可以执行,如果 l = 2 ^ 31 则已经超出范围了。