[swfmill] Patch: accurate format for floating point values

INADA Naoki inada-n at klab.org
Fri Feb 8 04:18:38 PST 2008


Hi swfmill users and developers.

Some floating point values have a little error when swfmill converts swf -> xml -> swf.

Some format of floating and fixed point values is in swf. Swfimill output format lacks number of significant figures for several of those.

Attached patch fixes this problem in following way.
 1. use 'double' for all of real (floating and fixed point) numbers in swf. 
 2. use "%-.60lg" for printf format.


* Why %-.60lg ?
Double-precision floating point value have 52 bit of significant number.
(http://en.wikipedia.org/wiki/IEEE_floating-point_standard)
And 10 contains 2 as a factor. So decimal real number needs 52 significant figures for accurate representation of double-precision floating point value.
60 have some room against 52. And %-.60lg prints no unnecessary 0s.

-- 
Sorry about my poor English.

INADA Naoki <inada-n at klab.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: precision_float.patch
Type: application/octet-stream
Size: 5428 bytes
Desc: not available
Url : http://osflash.org/pipermail/swfmill_osflash.org/attachments/20080208/d95f9db2/attachment.obj 


More information about the swfmill mailing list