« first day (2016 days earlier)      last day (2924 days later) » 

4:36 AM
Hello all. Why does java round down the value of aDoubleValue so the output is 3? This isn't solving a problem, I just wondered why. Thanks

double aDoubleValue = 3.6456466464;
int doubleToInt = (int) aDoubleValue;
System.out.println(doubleToInt);
 
I have no statements to make of either "yummy food", or "cats"; but, I do want to say that after a foray into recursion in Scheme, I am somewhat relieved to be back in imperative territory.
It just truncates the value without regard to the fractional part.
@Jdoh, there's truncation, not rounding.
 
Thanks :)
 
Sure.
There's probably a library out there for rounding, though.
 
Like I said, no need for it. Just wondered why as everything I googled gave example code of how to round
 
Ah, I see.
Yeah, it's called "casting". The double value is demoted to an int by, basically, removing the fractional part of the floating-point value.
If you had the reverse conversion, from an int to a double, you'd just get 2 -> 2.00.
G'night.
 
 
10 hours later…
2:52 PM
Morning, Java!
 
 
2 hours later…
4:29 PM
@AdrianM. Math.round()
 
Neo
4:58 PM
Hello all
 
5:52 PM
Hi guys I'm making a Jframe application. I want it to look more professional. Is there a way I can just add a box, to send to the back ground and have it a different colour?
 
 
3 hours later…
9:15 PM
Hello
 
Neo
9:31 PM
Hello
Could someone help me with this error message: pastebin.com/55uZzHH8
pastebin.com/55uZzHH8
I'm just trying to create a maven project in eclipse
I tried few things in the forum but no results
 
10:06 PM
run "Maven > Update Project" from the context menu
at least that's the suggestion here
 

« first day (2016 days earlier)      last day (2924 days later) »