List Info

Thread: Re: Patch: accurate format for floating point values




Re: Patch: accurate format for floating point values
user name
2008-02-11 12:58:17
You use Gay's strtod and g_fmt from those files.  The dtoa
only needs a 
char buf[32] as well, so you don't need to allocate.

Chris


INADA Naoki wrote:
>> I'll make patch and send here again with netlib
fp.
> 
> Oops! Netlib have a ftoa() but no atof().
> 
> Python works fine about float as below. I'll try
importing from python.
> Python's code is released under GPL-compatible
license.
> 
> In [1]: from struct import unpack
> In [2]: d = unpack('>d', 'x00x0f'+'xff'*6)[0]
> In [4]: repr(d)
> Out[4]: '2.2250738585072009e-308'
> In [5]: float(repr(d)) == d
> Out[5]: True
> 
> 
> 

_______________________________________________
swfmill mailing list
swfmillosflash.org
http://osflash.org/mailman/listinfo/swfmill_osflash.org

Re: Patch: accurate format for floating point values
user name
2008-02-11 13:08:03
s/dtoa/g_fmt/ in my response.

Oh, also, on msvc 2003 I set the following preprocessor
stuff:

#define IEEE_8087 1
#pragma optimize ("p",on)      // improve floating
point consistency, 
yay, needed to actually work in my stochastic testing
#pragma warning (disable:4554) // '>>' : check
operator precedence for 
possible error; use parentheses to clarify precedence
#pragma warning (disable:4018) // '<=' : signed/unsigned
mismatch
#pragma warning (disable:4102) // 'trimzeros' : unreferenced
label
#pragma warning (disable:4706) // assignment within
conditional expression


Chris


Chris Hecker wrote:
> You use Gay's strtod and g_fmt from those files.  The
dtoa only needs a 
> char buf[32] as well, so you don't need to allocate.
> 
> Chris
> 
> 
> INADA Naoki wrote:
>>> I'll make patch and send here again with netlib
fp.
>> Oops! Netlib have a ftoa() but no atof().
>>
>> Python works fine about float as below. I'll try
importing from python.
>> Python's code is released under GPL-compatible
license.
>>
>> In [1]: from struct import unpack
>> In [2]: d = unpack('>d',
'x00x0f'+'xff'*6)[0]
>> In [4]: repr(d)
>> Out[4]: '2.2250738585072009e-308'
>> In [5]: float(repr(d)) == d
>> Out[5]: True
>>
>>
>>
> 
> _______________________________________________
> swfmill mailing list
> swfmillosflash.org
> http://osflash.org/mailman/listinfo/swfmill_osflash.org
> 

_______________________________________________
swfmill mailing list
swfmillosflash.org
http://osflash.org/mailman/listinfo/swfmill_osflash.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )