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 2 of 2

Thread: How would I compare the square of the square root of any number.

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How would I compare the square of the square root of any number.

    How would I compare the square of the square root of any number. The difference in these values is due to the rounding error in Java.

    Example: Enter number 2

    The answer I should get is: 2.000000000000004
    Round off error: -4.440892

    The answers are estimated answers but are very close


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How would I compare the square of the square root of any number.

    How would I compare
    Use the standard operators to compare primitives: ==, !=, <, <= etc
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. square root
    By bombaj7 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 14th, 2013, 07:52 AM
  2. HW Accelerated Square Root
    By tomster in forum Java SE APIs
    Replies: 2
    Last Post: October 3rd, 2011, 05:12 AM
  3. Square root not working
    By sp11k3t3ht3rd in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 7th, 2011, 06:25 PM
  4. Finding square root
    By Tracy22 in forum The Cafe
    Replies: 1
    Last Post: October 18th, 2010, 06:18 PM
  5. Java program Square root
    By Hey in forum Java Theory & Questions
    Replies: 5
    Last Post: August 16th, 2009, 01:14 AM