Nakul,

I try with String , but it doesn't work for me.

Please check out following

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
        <mx:Script>
                <![CDATA[
                        private function getMaxValue():String{
                                trace("Fixed : 
"+Number(9999999999999.99899).toFixed(19));
                                trace("precision : " +
Number(9999999999999.99999).toPrecision(19));
                                return '9999999999999.99999';
                                //return Number(10000000000000-0.00001);
                        }
                        private function clickHandler():void{
                                var num:String = getMaxValue();
                                trace(num);
                                var value:Number = Number(num);
                                //do some operation
                                txtOutput.text = value.toString();
                        }
                ]]>
        </mx:Script>
        <mx:Text id="txtOutput" />
        <mx:Button label="Get Value" click="clickHandler()"/>
</mx:Application>



On Mar 19, 1:40 pm, nakul mishra <[email protected]> wrote:
> Hi,
> Try to use
> function toPrecision(precision:uint):String;
>     precision:uint — An integer between 1 and 21, inclusive, that represents
> the desired number of digits to represent in the resulting string.
>
> Returns
>     String — A string representation of the number either in exponential
> notation or in fixed-point notation. The string will contain the number of
> digits specified in the precision parameter.
>
> Throws
>     RangeError — Throws an exception if the precision argument is outside
> the range 1 to 21.
>
> May be it will be of some help
>
>
>
> On Fri, Mar 19, 2010 at 7:50 AM, Nargis <[email protected]> wrote:
> > Hi,
>
> > I am getting some issue with number data type.
> > Please check out following
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="vertical">
> >        <mx:Script>
> >                <![CDATA[
> >                        private function getMaxValue():Number{
>
> >                                return Number(9999999999999.99999);
> >                        }
> >                        private function clickHandler():void{
> >                                var num:Number = getMaxValue();
> >                                trace(num);
> >                                txtOutput.text = getMaxValue().toString();
> >                        }
> >                ]]>
> >        </mx:Script>
> >        <mx:Text id="txtOutput" />
> >        <mx:Button label="Get Value" click="clickHandler()"/>
> > </mx:Application>
>
> > Here i am expecting out put as (9999999999999.99999) but the function
> > returns 10000000000000.
>
> > Please let me know if any one has solution for this.
>
> > -Nargis
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Flex India Community" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<flex_india%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/flex_india?hl=en.
>
> --
> Regards
> Nakul

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to