Results 1 to 2 of 2
Thread: Divison - Double
- 11-17-2008, 09:43 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 6
- Rep Power
- 0
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.
- 11-17-2008, 10:01 PM #2
Member
- Join Date
- Nov 2008
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
Double Buffering
By dunff2k in forum SWT / JFaceReplies: 1Last Post: 11-14-2008, 03:26 PM -
Double Value problem
By sakthivel123 in forum New To JavaReplies: 2Last Post: 07-10-2008, 04:18 PM -
Calculating sin of a double value
By Java Tip in forum Java TipReplies: 0Last Post: 01-13-2008, 08:13 PM -
transforming double to int
By AlejandroPenton in forum New To JavaReplies: 2Last Post: 12-11-2007, 01:34 AM -
Getting smallest possible Double value
By Java Tip in forum Java TipReplies: 0Last Post: 12-06-2007, 02:15 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks