posted 23 years ago
Hi Velmurugan,
You have done a great work by collecting all the information required for the exam. I am taking the exam on Feb 9th.
I would like to point out an error in your notes:
-----------------------------------------------------
Floating point arithmetic always loses precision. The following code fragment returns false.
float f = 1.0 F / 3.0 F; if ( A * 3.0 F == 1.0 F ) return true; else return false;
-----------------------------------------------------
I assume A in the above expression is a typo. it is f.
If that is the case, then as such the above expression will return true, because even though u r making f to get a less precisioned value when u multiply by 3.0F u get back the same 1.0F u used to obtian f.
If it was just 3.0 then i agree with u that it is false (since LHS is a double and the RHS when promoted to double will not match it).
thanks
Sun Certified Programmer for Java 2 Platform