Hi Anjali,
A lightning:formattedNumber component displays formatted numbers for decimals, currency, and percentages. This component uses the Intl.NumberFormat JavaScript object to format numerical values. The locale set in the app's user preferences determines how numbers are formatted.
The component has several attributes that specify how number formatting is handled in your app. Among these attributes are minimumSignificantDigits and maximumSignificantDigits. Significant digits refer the accuracy of a number. For example, 1000 has one significant digit, but 1000.0 has five significant digits. Additionally, the number of decimal places can be customized using maximumFractionDigits.
- Decimal numbers default to 3 decimal places. This example returns 1234.568.
<aura:component>
<lightning:formattedNumber value="1234.5678" />
</aura:component>
- Currencies default to 2 decimal places. In this example, the formatted number displays as $5,000.00.<aura:component>
<lightning:formattedNumber value="5000" style="currency" currencyCode="USD" />
</aura:component>
- Percentages default to 0 decimal places. In this example, the formatted number displays as 50%.
<aura:component>
<lightning:formattedNumber value="0.5" style="percent" />
</aura:component