Results 1 to 8 of 8
  1. #1
    zhider is offline Member
    Join Date
    Oct 2012
    Posts
    37
    Rep Power
    0

    Default what is the math function to square a number/ variable?

    Area=(Math.PI*radius^2);
    ^2 obviously doesnt work, so how would I square the raduis? Thanks

  2. #2
    killutch is offline Member
    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    0

    Default Re: what is the math function to square a number/ variable?

    Math.sqrt(number) i think

  3. #3
    zhider is offline Member
    Join Date
    Oct 2012
    Posts
    37
    Rep Power
    0

    Default Re: what is the math function to square a number/ variable?

    Thanks a ton

  4. #4
    killutch is offline Member
    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    0

    Default Re: what is the math function to square a number/ variable?

    retract this post :/

  5. #5
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: what is the math function to square a number/ variable?

    Math.sqrt finds the square root. Perhaps you want Math.pow instead.

  6. #6
    pbrockway2 is online now Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,569
    Rep Power
    12

    Default Re: what is the math function to square a number/ variable?

    or foo*foo

  7. #7
    gowthamgutha is offline Member
    Join Date
    Sep 2012
    Location
    Guntur, India
    Posts
    27
    Rep Power
    0

    Default Re: what is the math function to square a number/ variable?

    No sqrt(number) gives square root not square.

  8. #8
    gowthamgutha is offline Member
    Join Date
    Sep 2012
    Location
    Guntur, India
    Posts
    27
    Rep Power
    0

    Default Re: what is the math function to square a number/ variable?

    Area=(Math.PI*(Math.pow(radius,2)));

    [Moderator edit: link removed]
    Last edited by DarrylBurke; 10-22-2012 at 05:06 AM.

Similar Threads

  1. Something weird about a math function
    By Mapisto in forum New To Java
    Replies: 7
    Last Post: 02-02-2012, 05:40 PM
  2. Replies: 3
    Last Post: 06-30-2011, 10:01 PM
  3. Help with Square root function and Overload(calc error)
    By racingoutbac in forum New To Java
    Replies: 3
    Last Post: 11-04-2010, 01:09 AM
  4. Replies: 3
    Last Post: 04-16-2009, 02:42 AM
  5. math.random function help
    By katie in forum New To Java
    Replies: 2
    Last Post: 08-06-2007, 04:31 AM

Tags for this Thread

Posting Permissions

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