aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes -10.0/0 and -10/0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "-10.0/0 and -10/0" Watch "-10.0/0 and -10/0" New topic
Author

-10.0/0 and -10/0

david chan
Ranch Hand

Joined: Jun 10, 2002
Posts: 46
why ?
double d = -10.0/0; //ok
double d = -10/0; //throw java.lang.ArithmeticException: / by zero
David
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Java uses the IEEE specification for float arithmetic which says that divide by zero returns infinity. Integer divide by zero throws an exception.
http://www.javaworld.com/javaworld/jw-10-1996/jw-10-hood.html


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
davidchantf,
Welcome to Javaranch
We'd like you to read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: -10.0/0 and -10/0