A bug caused by Decimal without SetScale

Let’s see the following Apex Script first.

In fact the Apex Script will throw an AssertException.
“System.AssertException: Assertion Failed: Expected: 0E-32%, Actual: 0%”.

So we’d better round the Decimal before we convert it to String.Like the following Apex Script.


Post Tagged with , , ,