'************************************** ' Name: Root Of ' Description:'Find the root of a base n ' umber by any exponential number. Project ' ->New, Standard EXE, Add Module, copy & ' paste this code into the new module, Pro ' ject->Project1 Properties, change startu ' p type to Sub Main(). Click okay and run ' . ' By: Nicholas Forystek ' ' ' Inputs:None ' ' Returns:None ' 'Assumes:None ' 'Side Effects:None '************************************** 'Find the root of a base number by any e ' xponential number. 'Project->New, Standard EXE, Add Module, ' copy & paste this 'code into the new module, Project->Proj ' ect1 Properties, 'change startup type to Sub Main(). Clic ' k okay and run. 'Output will look like this in the inter ' mediate window 'if you hit enter on the lines with the ' question marks ' '4/^256=4 '?4 ^ 4 ' 256 '2/^823543=907.492699695155 '?907.4929 ^2 ' 823543.36355041 ' '2/^56=7.48331477354788 '?7.50001 ^ 2 ' 56.2501500001 ' '2/^3283=57.2974694031072 '?57.3 ^ 2 ' 3283.29 ' '2/^256=16 '?16 ^2 ' 256 Public Sub Main() Debug.Print Debug.Print "4/^256=4" Debug.Print "?"; Debug.Print Root(4, 256) & " ^ 4" Debug.Print Debug.Print "2/^823543=" & Sqr(823543) Debug.Print "?"; Debug.Print Root(2, 823543) & " ^2" Debug.Print Debug.Print "2/^56=" & Sqr(56) Debug.Print "?"; Debug.Print Root(2, 56) & " ^ 2" Debug.Print Debug.Print "2/^3283=" & Sqr(3283) Debug.Print "?"; Debug.Print Root(2, 3283) & " ^ 2" Debug.Print Debug.Print "2/^256=" & Sqr(256) Debug.Print "?"; Debug.Print Root(2, 256) & " ^2" Debug.Print End Sub Public Function Root(ByVal expo As Double, ByVal base As Double) As Double Dim cnt As Long Dim temp As Double Root = (base * (((base / expo) * ((base / expo) * (base / (expo * base))) / ((base \ expo) - (expo \ _ base))) / base)) * (expo / 50) * (((expo / base) * (base \ expo)) / ((base \ expo) ^ expo) / 100) cnt = -1 Do Do While Round(Root ^ expo, Len(Trim(Str(base - (Round(base, 0))))) - 1) < base Root = Root + CDbl("." & String(Len(Trim(Str(base - (Round(base, 0))))) + cnt, "0") & "1") Loop cnt = cnt + 1 Do While Round(Root ^ expo, Len(Trim(Str(base - (Round(base, 0))))) - 1) > base Root = Root - CDbl("." & String(Len(Trim(Str(base - (Round(base, 0))))) + cnt, "0") & "1") Loop If cnt > 10 Then cnt = -1 temp = Round(Root, Len(Trim(Str(base - (Round(base, 0))))) + cnt) Loop Until Round(temp ^ expo, 0) = Round(base, 0) And (((Len(Trim(Str((temp ^ expo) - (Round((temp ^ expo), 0)))))) > 10) _ Or (Len(Trim(Str((temp ^ expo) - (Round((temp ^ expo), 0))))) = Len(Trim(Str(base - (Round(base, 0))))))) Root = temp End Function