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

Continued Fraction Function
Math Arithmetic Class

Public Function ContinuedFraction( _
      ByVal vB As Variant _
    , ByVal vA As Variant _
    , ByVal vX As Variant _
    , ByVal vN As Variant _
    ) As Variant

"Evaluate Continued Fraction"
Evaluates the continued fraction illustrated below.

Continued fraction:
                  A
    B + ---------------------
                    A
         B + ---------------
                   ...
                      A
              B + ---------
                        A
                   B + ---
                        X

Examples:
    ContinuedFraction(2, 3, 4, 0) = 4
    ContinuedFraction(2, 3, 4, 1) = 2.75
    ContinuedFraction(2, 3, 4, 2) = 3.09090909090909
    ContinuedFraction(2, 3, 4, 3) = 2.97058823529412
    ContinuedFraction(2, 3, 4, 4) = 3.00990099009901
    ContinuedFraction(2, 3, 4, 5) = 2.99671052631579
    ContinuedFraction(2, 3, 4, 6) = 3.00109769484083
vB, vA, vX: Numeric values which are substituted into the above expression then evaluated. Function returns Null if any of these values are Null or cannot be fixed up to numbers.

vN: The number of divisions to perform within the continued fraction. vN defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. Function returns vX if vN is <= 0 (less than or equal to zero).

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