[swfmill] Patch: accurate format for floating point values

Chris Hecker checker at d6.com
Fri Feb 8 10:21:33 PST 2008


I think if you want to do this you should use David Gay's routines:

http://www.netlib.org/fp/

dtoa.c & g_fmt.c

Chris


INADA Naoki wrote:
> 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.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> swfmill mailing list
> swfmill at osflash.org
> http://osflash.org/mailman/listinfo/swfmill_osflash.org



More information about the swfmill mailing list