Doug,

    We need to store an integer.  This is what we want to do.  We have 
about 100,000 transactions containing volumes that may go as high as 
hundreds of millions.  At the end of the day, we have to accept the total 
volume from the user which may reach as high as 17 digits and compare it 
with the volume calculated in the database.  This kind of rounding error 
might cause the comparison to file.

     usting Int or uInt is worse.  Here is the code and output

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute
" creationComplete="initApp()">
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        [Bindable] private      var jdx:Number;
                        [Bindable] private var idx:int;
                        [Bindable] private var kdx:uint;
                        private function initApp():void {
                                idx = 12345678901234567;
                                jdx = 12345678901234567;
                                kdx = 12345678901234567;
                        } 
 
                ]]>
        </mx:Script>
        <mx:Form>
                <mx:FormItem label="Number:" >
                        <mx:TextInput text="{jdx}" /> 
                </mx:FormItem>
                <mx:FormItem label="Int:" >
                        <mx:TextInput text="{idx}" /> 
                </mx:FormItem>
                <mx:FormItem label="uint:" >
                        <mx:TextInput text="{kdx}" /> 
                </mx:FormItem>
        </mx:Form>
</mx:Application>

Output:




Jay Jayaraman
Central Billing Services
Financial Management and Planning
(404) 498-8453 (W)
(404) 273-7131 (C)



"Douglas Knudsen" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
04/11/2008 02:02 PM
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: [AFFUG Discuss] Problem with large integer numbers






Jay, meant to look at this earlier.  I suspect its due to precision 
loss/gain and how Number is stored and when toString() does its thing.  I 
think I recall a discussion over on flexcoders on this too.  Not to skirt 
or excuse the issue, but do you need to store a float or int here?  I'd be 
curious what your experiment yields with a int type. 

DK

On Fri, Apr 11, 2008 at 1:50 PM, <[EMAIL PROTECTED]> 
wrote:

I am surprised there is no response.    We have a real need for a solution 
to this problem.  Should this probably  be sent to Adobe directly instead 
of putting it in front of the user group? 


Jay Jayaraman
Central Billing Services
Financial Management and Planning
(404) 498-8453 (W)
(404) 273-7131 (C) 


[EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 
04/08/2008 04:18 PM


Please respond to
[email protected]


To
[email protected] 
cc

Subject
Re: [AFFUG Discuss] Problem with large integer numbers









Even when I bind this large numbet to TextInput Control, it shows 
123456789012345768 

Here is the code 

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute
" creationComplete="initApp()"> 
       <mx:Script> 
               <![CDATA[ 
                       import mx.controls.Alert; 
                               [Bindable] 
                       private        var jdx:Number = 12345678901234567; 
                       private function initApp():void { 
                               Alert.show(jdx.toString()); 
                       } 
 
               ]]> 
       </mx:Script> 
       <mx:TextInput text="{jdx}" /> 
</mx:Application> 


Jay Jayaraman
Central Billing Services
Financial Management and Planning
(404) 498-8453 (W)
(404) 273-7131 (C) 

[EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 
04/08/2008 04:13 PM 


Please respond to
[email protected]



To
[email protected] 
cc

Subject
[AFFUG Discuss] Problem with large integer numbers











Has anybody seen this? 

When I stored a 17 digit number in Number type actionscript variable and 
tried to display it using Alert, I got a different number. 

Here is the program 

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute
" creationComplete="initApp()"> 
      <mx:Script> 
              <![CDATA[ 
                      import mx.controls.Alert; 
                      private function initApp():void { 
                              var jdx:Number = 12345678901234567; 
                              Alert.show(jdx.toString()); 
                      } 
 
              ]]> 
      </mx:Script> 
</mx:Application> 

Alert Box shows 12345678901234568 


Jay Jayaraman
Central Billing Services
Financial Management and Planning
(404) 498-8453 (W)
(404) 273-7131 (C) 
------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in 
the subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink 
------------------------------------

------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in 
the subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink 
------------------------------------------------------------- 

------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in 
the subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink 
------------------------------------------------------------- 



-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it? 
------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in 
the subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink 
------------------------------------------------------------- 

<<image/gif>>

Reply via email to