Method
Reverses the sign of a BCD number.
Category
BCD
Syntax
Sub BcdNeg(ByVal hBcd As Long)
hBcd
The handle to the BCD number.
Example
hBCD = CF1.AllocBcd
tmpLong = -1
tmpLong2 = 1
CF1.LongToBcd tmpLong, hBCD
CF1.BcdNeg (hBCD)
tmpVar = CF1.BcdToLong(hBCD)
If CLng(tmpVar) = tmpLong * (-1) Then
CF1.LongToBcd tmpLong2, hBCD
CF1.BcdNeg (hBCD)
tmpVar = CF1.BcdToLong(hBCD)
If CLng(tmpVar) = tmpLong2 * (-1) Then
logWr "BcdNeg OK"
Else
logWr "BcdNeg failed with -1"
End If
Else
logWr "BcdNeg failed with 1"
End If
CF1.FreeBcd hBCD
Comments
BcdNeg reverses the sign of the BCD number hBcd. For example, -3
becomes 3, 4 becomes -4 and 0 remains 0.