Results 1 to 2 of 2
  1. #1
    new person is offline Member
    Join Date
    Nov 2008
    Posts
    6
    Rep Power
    0

    Default Divison - Double

    I'm slightly confused by a couple of questions i have to answer for some Java work [I'm new to it].

    The first is:

    What is the result of 100/3? 100/3.0? Explain why are these different?

    To which i wrote:

    The difference is if you don't specify the .0 then it treats the answer as a simple (int) and rounds the answer to a whole number [33]. Whereas if you Do specify the .0 it treats it as a decimal number using (double) and so returns a decimal answer [33.333..]

    But the next 3-4 questions all seem to be asking the exact same thing:

    What is the result of 1/10? Explain
    What is the result of 4/6? 4.0/6.0? Explain why are these different?
    What is the result of (5/2)*3.0? (5/2)*3? Explain why are these different?

    So that leads me to believe that i'm missing something, otherwise they wouldn't keep asking the same question if it was the same answer all the time..

    So, is that the case? Am i missing something, or are they actually just asking the same question 4 times with the same answer 4 times?

    Thank you.

  2. #2
    satin is offline Member
    Join Date
    Nov 2008
    Posts
    8
    Rep Power
    0

Similar Threads

  1. Double Buffering
    By dunff2k in forum SWT / JFace
    Replies: 1
    Last Post: 11-14-2008, 04:26 PM
  2. Double Value problem
    By sakthivel123 in forum New To Java
    Replies: 2
    Last Post: 07-10-2008, 05:18 PM
  3. Calculating sin of a double value
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-13-2008, 09:13 PM
  4. transforming double to int
    By AlejandroPenton in forum New To Java
    Replies: 2
    Last Post: 12-11-2007, 02:34 AM
  5. Getting smallest possible Double value
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-06-2007, 03:15 PM

Posting Permissions

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