12-27-2023, 10:29 PM
Hope this helps, directly assigned hex values under 16 bits are fine... but go over and it blows up. But the math still functions correctly when you go over 16 bits.
Code: (Select All)
Screen _NewImage(100, 35, 0)
Print "unsingned integer"
Dim Q As _Unsigned Integer
Q = &H7FFF
Print Hex$(Q), _Bin$(Q), Q
Q = &H8FFF
Print Hex$(Q), _Bin$(Q), Q
Print "integer"
Dim Q2 As Integer
Q2 = &H7FFF
Print Hex$(Q2), _Bin$(Q2), Q2
Q2 = &H8FFF
Print Hex$(Q2), _Bin$(Q2), Q2
Q2 = &H8000
Print Hex$(Q2), _Bin$(Q2), Q2
Print "long"
Dim Q3 As Long
Q3 = &H7FFF
Print Hex$(Q3), _Bin$(Q3), Q3
Q3 = &H8FFF
Print Hex$(Q3), _Bin$(Q3), Q3
Q3 = &H8000
Print Hex$(Q3), _Bin$(Q3), Q3
Print "unsigned long"
Dim Q4 As _Unsigned Long
Q4 = &H7FFF
Print Hex$(Q4), _Bin$(Q4), Q4
Q4 = &H8FFF
Print Hex$(Q4), _Bin$(Q4), Q4
Q4 = &H8000
Print Hex$(Q4), _Bin$(Q4), Q4
Print "integer 64"
Dim Q5 As _Integer64
Q5 = &H7FFF
Print Hex$(Q5), _Bin$(Q5), Q5
Q5 = &H8FFF
Print Hex$(Q5), _Bin$(Q5), Q5
Q5 = &H8000
Print Hex$(Q5), _Bin$(Q5), Q5
Print "unsigned integer 64"
Dim Q6 As _Unsigned _Integer64
Q6 = &H7FFF
Print Hex$(Q6), _Bin$(Q6), Q6
Q6 = &H8FFF
Print Hex$(Q6), _Bin$(Q6), Q6
Q6 = &H8000
Print Hex$(Q6), _Bin$(Q6), Q6
Print "unsigned integer 64"
Q6 = &H7FFF
Print Hex$(Q6), _Bin$(Q6), Q6
Print Hex$(Q6 + 1), _Bin$(Q6 + 1), Q6 + 1
Print Hex$(Q6 + 2), _Bin$(Q6 + 2), Q6 + 2
Print "unsigned integer 64 but value is assigned as an integer"
Q6 = 32767
Print Hex$(Q6), _Bin$(Q6), Q6
Print Hex$(Q6 + 1), _Bin$(Q6 + 1), Q6 + 1
Print Hex$(Q6 + 2), _Bin$(Q6 + 2), Q6 + 2