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是不是和一个同样值得整型相当

解决方案 »

  1.   

    Dim c As Currency
      c = 919999999999991#
      Debug.Print c最大值大约在这个数附近。
      

  2.   

    请参考Private Sub Form_Load()
      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
      

  3.   

    Currency 变量存储为 64 位(8 个字节)整型的数值形式,然后除以 10,000 给出一个定点数,其小数点左边有 15 位数字,右边有 4 位数字。这种表示法的范围可以从 -922,337,203,685,477.5808 到 922,337,203,685,477.5807。Currency 的类型声明字符为at号 (@)。Currency 数据类型在货币计算与定点计算中很有用,在这种场合精度特别重要。
      

  4.   

    cangwu_lee(小橙子) 能具体解释一下我的问题吗
      

  5.   

    VB的Long类型好像是 32 位的,所以不够了。  Dim  l As Long
      l = 2 ^ 30
      Debug.Print l可以执行,如果  l = 2 ^ 31 则已经超出范围了。