Private Sub QuadraticRootSample() ' Print some samples of the QuadraticRoot function. Debug.Print "AX^2 + BX + C = 0" Randomize Dim intCurTry As Integer For intCurTry = 1 To 5 Debug.Print Dim A As Double Dim B As Double Dim C As Double A = Rnd - 0.5 B = Rnd - 0.5 C = Rnd - 0.5 Debug.Print "A = " & A Debug.Print "B = " & B Debug.Print "C = " & C Dim X1 As Variant Dim X2 As Variant X1 = QuadraticRoot(A, B, C, 1) X2 = QuadraticRoot(A, B, C, 2) Debug.Print "X1 = " & X1 Debug.Print "X2 = " & X2 ' Evaluate the quadratic expression for both roots. Debug.Print "Eval X1 = " & QuadraticExpr(A, B, C, X1) Debug.Print "Eval X2 = " & QuadraticExpr(A, B, C, X2) Next intCurTry End Sub
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.