Resolution: Description: =========== Result of double value calculations incorrect.
Environment: =========== TIBCO BusinessEvents 3.x,4.x, 5.x All Operating Systems
Symptoms: ========= Result of double calculation doesn’t return exact result .
Example: double a = 1; double b = 0.9; System.debugOut("Result : " + (a - b));
Result is 0.09999999999999998
Cause: ====== Java limitation
Resolution: ======== Use Math.roundFraction() to return the correct result.
Example: double c = Math.roundFraction(a-b, 15); System.debugOut("Result after round: " + Math.roundFraction(a-b, 15)); System.debugOut("Result2 after round: " + c );
Note: A double decimal should have a precision of 15 digits at max ( see http://en.wikipedia.org/wiki/Double_precision).