Unformatted text preview: MsgBox ("The calculated e^x value = " & exponent & " and e(x) = " & E) End Sub Function whole(ByVal maxvalue As Double, ByRef x As Double) As Single Dim i As Single, n As Single, a As Single i = 0 n = 0 whole = 1 Do n = n + 1 a = (x ^ n) / (fact(n)) If (Abs(a) <= maxvalue) Then Exit Do whole = whole + a i = i + 1 Loop End Function Function fact(ByVal n As Single) As Single Dim s As Integer fact = 1 For s = 1 To n fact = fact * s Next s End Function Discussion : For an xvalue of 1, the e x function returns a value of 2.718 and the e(x) function returns the same value. Also, the e x function should return the same value as e(x) for any value x....
View
Full Document
 Fall '07
 Sengupta
 Return statement, Ring, maxValue

Click to edit the document details