Use round(), ceiling(), and floor() to round or truncate to decimal place values. : Math : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » Math »

 

Use round(), ceiling(), and floor() to round or truncate to decimal place values.


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var nValue:Number = 6.39639;
        nValue *= 100;
        nValue = Math.floor(nValue);
        nValue /= 100;
        trace(nValue);  // Displays: 6.39
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» Math