I am using Flex2.0, and I try to get a result about 3 multiply 7.9,
the result should be 23.8, but I got 23.700000000000003.

Here is a sample code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:TextInput x="76" y="348" id="txt_1" text="3"/>
        <mx:TextInput x="291" y="348" id="txt_2" text="7.9"/>
        <mx:TextInput x="560" y="348" id="txt_3"/>
        <mx:Button x="474" y="348" label="Button" click="doIt()"/>
        <mx:Script>
        <![CDATA[
        private var num1:Number = 3;
        private var num2:Number = 7.9;
        
        private function doIt():void
        {
                txt_3.text = String(Number(txt_1.text) * Number(txt_2.text));
                trace(num1 * num2);
        }
            ]]>
    </mx:Script>
</mx:Application>









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to