This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Special/extreme cases in Math Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Special/extreme cases in Math" Watch "Special/extreme cases in Math" New topic

Special/extreme cases in Math

Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
For the exam, to what extent do I need to know about the special cases in Math?
I've summarized the outputs for the Math methods with the arguments:NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY, MIN_VALUE, MAX_VALUE and value less than 0. Is that good enough? If not, how extreme cases do I need to know?
In KnB book of page 375, it mentions that "There are many more, but if you know these you will be in good shape for the exam." What are these special cases?
double nan = Double.NaN;
double n_i = Double.NEGATIVE_INFINITY;
double p_i = Double.POSITIVE_INFINITY;
double min_v = Double.MIN_VALUE;
double max_v = Double.MAX_VALUE;
double neg_v = -0.5;
sin(nan), sin(n_i), sin(p_i), sin(min_v), sin(max_v), sin(neg_v)
Many thanks in advance.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
couple more to add
-Double.MIN_VALUE represents the smallest positive value that is greater than zero.
-Float.MIN_VALUE represents the smallest positive value that is greater than zero

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Thank Andres for the input.
I read the topic "Expressions" from Java Language Specification (2nd Edition) and realized that there're many other Math special cases. Well, it's really worth taking a look...but as for memorization...Hmmm...
I agree. Here's the link:
subject: Special/extreme cases in Math
Similar Threads
Trouble with java's sin() method
Special cases in Math methods
Math Class methods and Special cases
Double, isNaN and v != v