So:
//aValue = 4.45
//bValue = 4.35
//maxValueDiff = 0.1
//The absolute value of a - b = 0.1
if( Math.abs(aValue - bValue) <= maxValueDiff ) return true;
logger.info("valueDiffCheck a:" + aValue +" b:"+ bValue + " e1:" + maxValueDiff);
Why do I see this in my logs:
valueDiffCheck a:4.45 b:4.35 e1:0.1
Suspect this is because Double is a double pain with it's inaccuracies but if that were the case shouldn't I see that? Like it should print that 0.1 is actually 0.10000000111 or something? ...or is there something pesky about the printing format?
The target code is high performance with a LOT of data so we don't want to use BigDecimal. What's the next best thing to ensure that 0.44 is 0.44?
OK let me state unequivocally that we only need two decimal places. The accuracy involved in using BigDecimal is major overkill.