This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rules roundup #113  RSS feed

 
Arnold Reuser
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question : What happens when you have this in you code
double x; x = 24.0/0;
Answer : Compiles and runs.
Floating point numbers don�t produce a divide-by-zero ArithmeticException. They will give a result which is a Not a Number value.
Maybe the answer should be : Compiles and runs.
Floating point numbers don�t produce a divide-by-zero ArithmeticException. They will give a result which is Double.POSITIVE_INFINITY.
Also notice that 24.0%0 gives NaN.
 
Rajith Vidanaarachchi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I previously thought that the answer was correct but now I typed it and Compiled it and got the output.You are correct!


[ December 21, 2004: Message edited by: Rajith Vidanaarachchi ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!