2 Replies Latest reply on Jan 17, 2012 11:01 PM by senthil s

    Doubt in roundup decimal number

    senthil s Level 1

      Hello,    Please guide me, how to round up in next higher number.    If   2.3567 Then,  Round up Result should be 2.4   Thanks in advance.  Senthil

        • 1. Re: Doubt in roundup decimal number
          kraikit Level 2

          Sample code:

                                                  var f:Number = 2.3567;

                                                  trace("round: " + Math.round(f));

                                                  trace("round to the tenth: " + (Math.round(f * 10) / 10));

           

          Result:

            round: 2

            round to the tenth: 2.4

           

           

          -- Tom

          • 2. Re: Doubt in roundup decimal number
            senthil s Level 1

            Thank you so much.   I tried    result=Math.round(f * 10) / 10;    instead of     result=(Math.round(f * 10) / 10);       Now working fine .......Thanks a lot  Senthil, Flex Developer