Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleCalculate Nth root of a number
Keywordsroot, power, Sqr
CategoriesAlgorithms
 
To calculate the Nth root of K, use the formula:

Exp(Log(K) / N)

 
Private Sub cmdCalculate_Click()
Dim the_root As Double
Dim the_number As Double
Dim the_result As Double

    On Error GoTo CalculateError
    the_root = CDbl(txtRoot.Text)
    the_number = CDbl(txtNumber.Text)
    txtResult.Text = Format$(Exp(Log(the_number) / _
        the_root))
    Exit Sub

CalculateError:
    txtResult.Text = "***"
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated