求教如何突破程序中16进制转换限制
请教,下面这段程序,最大只能将“7FFFFFFF”转换成十进制,再大就报溢出错误了,我猜想,这是Long的限制,因为Long最大也就是到“7FFFFFFF”,但计算机自带的计算器则并没有这个现象,可达到“7FFFFFFFFFFFFFFF”,它是怎样计算的呢?求能突破“7FFFFFFF”限制的方法,谢谢!程序代码:
Private Sub Command1_Click() Print HEX_to_DEC("80000000") End Sub Public Function HEX_to_DEC(ByVal Hex As String) As Long Dim i As Long Dim b As Long Hex = UCase(Hex) For i = 1 To Len(Hex) Select Case Mid(Hex, Len(Hex) - i + 1, 1) Case "0": b = b + 16 ^ (i - 1) * 0 Case "1": b = b + 16 ^ (i - 1) * 1 Case "2": b = b + 16 ^ (i - 1) * 2 Case "3": b = b + 16 ^ (i - 1) * 3 Case "4": b = b + 16 ^ (i - 1) * 4 Case "5": b = b + 16 ^ (i - 1) * 5 Case "6": b = b + 16 ^ (i - 1) * 6 Case "7": b = b + 16 ^ (i - 1) * 7 Case "8": b = b + 16 ^ (i - 1) * 8 Case "9": b = b + 16 ^ (i - 1) * 9 Case "A": b = b + 16 ^ (i - 1) * 10 Case "B": b = b + 16 ^ (i - 1) * 11 Case "C": b = b + 16 ^ (i - 1) * 12 Case "D": b = b + 16 ^ (i - 1) * 13 Case "E": b = b + 16 ^ (i - 1) * 14 Case "F": b = b + 16 ^ (i - 1) * 15 End Select Next i HEX_to_DEC = b End Function