<-- Previous || Up || Next -->

Quadratic Root Benchmark Sub
Math Complex Class

Private Sub QuadraticRootBenchmark()
    ' Run a benchmark of the QuadraticRoot function.

    'See also:
    '  QuadraticRoot Function
    '  CubicRootBenchmark Subroutine

    Dim lngMax As Long
    Dim lngTry As Long
    Dim varRtn As Variant

    lngMax = 256
    Debug.Print "Count = " & lngMax

    Debug.Print "Quadratic R: ";
    DebugTimerOn
    For lngTry = 1 To lngMax
        Dim QRA As Variant
        Dim QRB As Variant
        Dim QRC As Variant
        QRA = Rnd * 6 - 3
        QRB = Rnd * 6 - 3
        QRC = Rnd * 6 - 3

        varRtn = QuadraticRoot(QRA, QRB, QRC, 1)
        varRtn = QuadraticRoot(QRA, QRB, QRC, 2)
    Next lngTry
    Debug.Print DebugTimerOff

    Debug.Print "Quadratic C: ";
    DebugTimerOn
    For lngTry = 1 To lngMax
        Dim QCA As Variant
        Dim QCB As Variant
        Dim QCC As Variant
        QCA = RealToComplex(Rnd * 6 - 3, Rnd * 6 - 3)
        QCB = RealToComplex(Rnd * 6 - 3, Rnd * 6 - 3)
        QCC = RealToComplex(Rnd * 6 - 3, Rnd * 6 - 3)

        varRtn = QuadraticRoot(QCA, QCB, QCC, 1)
        varRtn = QuadraticRoot(QCA, QCB, QCC, 2)
    Next lngTry
    Debug.Print DebugTimerOff

End Sub

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.