• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rules roundup #113

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic