Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Math.IEEEremainder

 
Chitra Jay
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Will there be questions on Math.IEEEremainder method in the exam??
Math.IEEEremainder(7,2.5) o/p -0.5
Math.IEEEremainder(-7,2.5) o/p 0.5
Can anyone explain why?
Thanks
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There were no questions about this method on my 1.2 exam two weeks ago.
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the java.lang.Math.IEEEremainder method will not be on the exam. The exam only covers the following methods from the java.lang.Math class: abs, ceil, floor, max, min, random, round, sin, cos, tan, sqrt. For that reason, I removed the IEEEremainder methods from my mock exam.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Dan, I hope you are saving all those problems
you have removed for your forthcoming book "Questions you wanted to be asked for SCJP, but wern't"!
-Barry
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry,
Yes, I still have them. Maybe I should use them for an interview exam next time I'm in a management position.
Maybe that would be just a little too cruel.
 
Chitra Jay
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dan,
Can you tell me how IEEEremainder works.
Just a bit curious to know
Thanks
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chitra Jay:
Hello Dan,
Can you tell me how IEEEremainder works.
Just a bit curious to know
Thanks

Chitra,
The following is a question, answer, and remark from an earlier version of my mock exam.
class H {
public static void main (String[] args) {
double c = Math.IEEEremainder(5,3);
System.out.print(c);
}
}
Prints: -1.0
The Math.IEEEremainder method calculates the remainer using the IEEE 754 standard. The basic algorithm is f1 - f2 X n where n is an integer such that the absolute value of f1 - f2 X n is as small as possible. In this case, Java selects 2 for the value of n because the absolute value of 5 - 6 is smaller than the absolute value of 5 - 3.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic