skinned_knuckles
Member
- Joined
- Mar 14, 2005
- Messages
- 10
- Programming Experience
- 5-10
I'm using VB.net and the .framework version 2.0
I am puzzled why I can only assign values for UInt64 and ULong variables that are one-half the advertised 64 bit capacity. For signed integer values I know that one 1 bit represents the sign of the value but both of these variables are unsigned.
On my computer both variables accept the Hex 7FFFFFFFFFFFFFFF value but gives me a "Constant expression not representable in type 'ULong'. " when I try to assign the value of Hex 800000000000000 despite the fact that the max value is Hex FFFFFFFFFFFFFFFF
Public Sub Test()
Dim uint64Var As UInt64
Dim ulongVar As ULong
uint64Var = UInt64.MaxValue
uint64Var = UInt64.MinValue
uint64Var = &H7FFFFFFFFFFFFFFF
uint64Var = &H8000000000000000
ulongVar = ULong.MaxValue
ulongVar = ULong.MinValue
ulongVar = &H7FFFFFFFFFFFFFFF
ulongVar = &H8000000000000000
End Sub
I am puzzled why I can only assign values for UInt64 and ULong variables that are one-half the advertised 64 bit capacity. For signed integer values I know that one 1 bit represents the sign of the value but both of these variables are unsigned.
On my computer both variables accept the Hex 7FFFFFFFFFFFFFFF value but gives me a "Constant expression not representable in type 'ULong'. " when I try to assign the value of Hex 800000000000000 despite the fact that the max value is Hex FFFFFFFFFFFFFFFF
Public Sub Test()
Dim uint64Var As UInt64
Dim ulongVar As ULong
uint64Var = UInt64.MaxValue
uint64Var = UInt64.MinValue
uint64Var = &H7FFFFFFFFFFFFFFF
uint64Var = &H8000000000000000
ulongVar = ULong.MaxValue
ulongVar = ULong.MinValue
ulongVar = &H7FFFFFFFFFFFFFFF
ulongVar = &H8000000000000000
End Sub