' FB 1.05.0 ' Note that 'base' is a keyword in FB, so we use 'base_' instead as a parameter Function Pow Overload (base_ As Double, exponent As Integer) As Double If exponent = 0.0 Then Return 1.0 If exponent = 1.0 Then Return base_ If exponent < 0.0 Then Return 1.0 / Pow(base_, -exponent) Dim power As Double = base_ For i As Integer = 2 To exponent power *= base_ Next Return power End Function Function Pow Overload(base_ As Integer, exponent As Integer) As Double Return Pow(CDbl(base_), exponent) End Function ' check results of these functions using FB's built in '^' operator Print "Pow(2, 2) = "; Pow(2, 2) Print "Pow(2.5, 2) = "; Pow(2.5, 2) Print "Pow(2, -3) = "; Pow(2, -3) Print "Pow(1.78, 3) = "; Pow(1.78, 3) Print Print "2 ^ 2 = "; 2 ^ 2 Print "2.5 ^ 2 = "; 2.5 ^ 2 Print "2 ^ -3 = "; 2 ^ -3 Print "1.78 ^ 3 = "; 1.78 ^ 3 Print Print "Press any key to quit" Sleep