Results 1 to 8 of 8

Thread: Sqr And Sqrt

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    118

    Sqr And Sqrt

    i tried using the SQR function in VB,and it gave me a wrong answer. i did some search and i got this:

    # SQR
    The square function returns the square (ie the argument multiplied by itself) of its supplied argument,


    SQR( 2 ) returns 4

    # SQRT
    This function returns {always returns a real} the square root of its argument, eg,


    SQRT( 4 ) returns 2.0000000000E+00



    could someone explain how would i use each of these two functions in VB?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Sqr And Sqrt

    There is no SQRT in VB, I do not know what you were referencing
    SQR in VB: Returns the square root of a number
    To return the square: 4 * 4, or 4 ^ 2
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    118

    Re: Sqr And Sqrt

    so for example i have this equation i want to calculate in VB:

    4*Sqrt((98*800*1.00)/(4*Sqr(230)*Sin(Rad(2*70))))

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Sqr And Sqrt

    Replace Sqr(230) with (230*230)
    Then replace Sqrt with SQR
    There is also no RAD function in VB.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    118

    Re: Sqr And Sqrt

    how would i declare RAD?

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Sqr And Sqrt

    Other than Rapid Application Development, what is RAD?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    118

    Re: Sqr And Sqrt

    in math, it means radian

    i dimmed as double and added Rad=57.2958

    now im trying to do it with this equation:

    2*(ABS(46*800+SIN(PI()/180*-1)*1*800-COS(PI()/180*-1)*1*0))/(sqr(2*2)*175*sqrt(((46+SIN(PI()/180*-1)*1)*COS(PI()/180*-81)-COS(PI()/180*-1)*1*SIN(PI()/180*-81))*(0*COS(PI()/180*-81)-800*SIN(PI()/180*-81))))

    i got everything right, except for this part: sqrt(((46+SIN(PI()/180*-1)*1), and for the PI, i declared the PI as double and everything but it gives me "expected array" error
    Last edited by VbNooBie447; Feb 27th, 2009 at 11:14 AM.

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Sqr And Sqrt

    In case others might be interested, I found this

    http://www.devx.com/vb2themax/Tip/19029

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width