Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Question about math.pow

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Question about math.pow

    hi

    i run the following code:
    Math.pow(2,2)

    why the output is 4.012 and not 4?


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Question about math.pow

    The output I get is exactly 4. What is the exact code you're using? Perhaps there are computations which result either parameter to "about 2", which would throw the result off.

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Question about math.pow

    sorry, my mistake. it's print exactly 4.
    thnks

Similar Threads

  1. [SOLVED] Logic error in Math.pow(a,b) using JOptionPane
    By JAKATAK in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 8th, 2013, 01:18 AM
  2. Math.pow
    By britton33 in forum What's Wrong With My Code?
    Replies: 30
    Last Post: July 1st, 2012, 04:42 PM
  3. Confusion with Math.toDegrees() and Math.toRadians(). Please help.
    By marksquall in forum Java Theory & Questions
    Replies: 3
    Last Post: June 23rd, 2011, 01:28 AM
  4. Question on my math
    By SwEeTAcTioN in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 25th, 2009, 05:42 PM