Thanks guys for the responses. I'm actually not concerned with arbitrary precision just storing a 32-bit int (like a database key) and retrieving it accurately. I guess the only safe way in AS1/AS2 is to do the whole Math.round(value+0.01) thing.
Doug -----Original Message----- From: Jim Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, March 05, 2007 4:35 PM To: [email protected] Subject: Re: [Flashcoders] Number -- how good for use as an integer? Douglas Pearson wrote: > Can someone clarify whether Number is actually just a simple wrapper > round a double precision floating point value? > > Is this a problem with Flash? If so, any solutions? Internally, it's a 32-bit single precision float and doesn't play well if you need arbitrary precision integer manipulations. You can see the link that Mick recommended for a longer discussion of this from Adobe. This is a fairly common problem across many programming languages. As such, most developers needing such functionality (e.g. for financial, scientific or cryptographic usages) resort to libraries providing for arbitrary precision integer storage and operations. While I don't know of any ActionScript specific libraries for this, there are several that have been written for Javascript and shouldn't be too difficult to port if you're so inclined. Among others, see: http://www.leemon.com/crypto/BigInt.html http://www-cs-students.stanford.edu/~tjw/jsbn/ Jim Cheng effectiveUI _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

