BcdPower

Method
Raises a BCD number to a power.

Category
BCD

 

Syntax
Function BcdPower(ByVal hDstBcd As Long, ByVal hPowerBcd As Long) As Long

hDstBcd
The handle to the destination BCD number.

hPowerBcd
The handle to the BCD number that is the power to which the BCD number hDstBcd will be raised.

 

Example

hBCD = CF1.AllocBcd

  hBCD2 = CF1.AllocBcd

  tmpLong = 6

  tmpLong2 = 3

  CF1.LongToBcd tmpLong, hBCD

  CF1.LongToBcd tmpLong2, hBCD2

  tmpVar = CF1.BcdPower(hBCD, hBCD2)

  tmpVar2 = CF1.BcdToLong(hBCD)

  If VarType(tmpVar) = vbLong And CLng(tmpVar2) = tmpLong ^ tmpLong2 Then

  logWr "BcdPower OK"

  Else

  logWr "BcdPower failed"

  End If

  CF1.FreeBcd hBCD

  CF1.FreeBcd hBCD2

 

Comments
BcdPower raises the BCD number hDstBcd to the power of the BCD number hPowerBcd, and places the result in the BCD number hDstBcd.

For convenience, the function also returns a handle to the BCD number hDstBcd. This is useful in situations where the result is used to call yet another function, as in the following example:

h = BcdPow(BcdPow(dst, src),src1)

h and dst are now the same handle, and that handle refers to a BCD number with the value: (dst ** src) ** src1.



© 2009 Microsoft Corporation. All rights reserved.