# How to round off a calculation to 2 decimal points?

**URL:** <https://forum.kirupa.com/t/how-to-round-off-a-calculation-to-2-decimal-points/137587>\
**Category:** Uncategorized\
**Created:** [February 15, 2005, 11:36pm UTC](https://forum.kirupa.com/t/how-to-round-off-a-calculation-to-2-decimal-points/137587 "2005-02-15T23:36:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spikeypaul](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@Spikeypaul](https://forum.kirupa.com/u/Spikeypaul)\
**Post date:** [February 15, 2005, 11:36pm UTC](https://forum.kirupa.com/t/how-to-round-off-a-calculation-to-2-decimal-points/137587/1 "2005-02-15T23:36:57Z")

</div>

The following is the code for the press button:

```auto
on (press) {
var charges:Number = Number(charges_txt.text);
var payments:Number = Number(payments_txt.text);
var resultdivision:Number = payments / charges;
var resultpercentage:Number = resultdivision * 100;
 
if ( isNaN (charges)){
  resultimage_mc.gotoAndStop("error");
  
 }
 else if ( isNaN (payments)){
  resultimage_mc.gotoAndStop("error");
  
 }

 else if (resultpercentage < 67.8) {
  resultimage_mc.gotoAndStop("bad");
  percentage.text = resultpercentage + "%";
 }
 else {
  resultimage_mc.gotoAndStop("good");
  percentage.text = resultpercentage + "%";
 }
}

```

on the dynamic text labeled PERCENTAGE I cant get it to give me just 2 decimals. What can I add ???
