File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
I agree. Here's the link:
subject: data type of results of java arithmetic calculation
Not Getting Compilation Error?
does == count as arithmetic calculation?
why ceil & floor accepts int
Tricky question.... plz help
date type "Long" range too small?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013