posted 6 years ago

I understand that you shouldn't use equals for comparing two double values but does the same hold true for comparing a double to a literal using less than and greater than?

I have a double variable which holds an angle in degrees calculated using Math.asin and Math.toDegrees etc. If I then compare this to the literal

I have a double variable which holds an angle in degrees calculated using Math.asin and Math.toDegrees etc. If I then compare this to the literal

**90**will the result always be**true**no matter how close**a**is to but less than**90**and**false**no matter how close**a**is to but greater than**90**? I'm thinking if**a**was calculated to be**89.999999998**but the literal**90**is stored internally as**89.999999996**;SCJA, OCPJP, OCMJD

Campbell Ritchie

Marshal

Posts: 56584

172

Campbell Ritchie

Marshal

Posts: 56584

172