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 x-value 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
This note was uploaded on 09/18/2011 for the course ENGR 160 taught by Professor Sengupta during the Fall '07 term at Iowa State.
- Fall '07