A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
data type of results of java arithmetic calculation
Joined: Jul 17, 2010
Apr 02, 2012 12:43:59
, I know the data type of the result of an arithmetic calculation depends on the data types of the numbers involved in the calculation. For example,
int + int = int
a. But I can't find any references which can give me all these rules. Could someone help me?
b. How to avoid over flow in arithmetic calculation? For example, the results of 2 long may not fit into a long anymore...
Thanks a lot.
Joined: Aug 22, 2010
Apr 02, 2012 12:51:15
is the most authoritative source on the issue of type conversions in Java.
Java itself does not check integer arithmetic overflows, but I've found this
interesting tool which does so
It is sorta covered in the
JavaRanch Style Guide
subject: data type of results of java arithmetic calculation
date type "Long" range too small?
why ceil & floor accepts int
Not Getting Compilation Error?
does == count as arithmetic calculation?
Tricky question.... plz help
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014