On Apr 24, 2013, at 7:03 PM, Heesob Park wrote:

> 2013/4/25 David MacMahon <davidm / astro.berkeley.edu>
>>=20
>> Nice work tracking this down!
>>=20
>> I don't understand how it fixes the compiler specific aspect of the
>> problem you found where gcc 4.5.2 on MinGW had the problem but gcc =
4.7.2 on
>> MinGW did not.  Does gcc 4.7.2 on MinGW already automatically do =
whatever
>> "_control87(_PC_53, _MCW_PC)" does, but gcc 4,5,2 on MinGW does not
>> automatically do it so it needs to be done explicitly?
>>=20
> The console application built with mingw32 compiler  calls _fpreset
> funciton at startup.
> The _fpreset function is defined in MSVCRT.dll which set FP default
> precision to 53 bit mantissa.
>=20
> But in mingwrt-3.18 library which bundled in mingw32 4.7.2 redefined
> _fpreset function to change FP default precision from 53 to 64-bit
> mantissa.
> Actually, the "_control87(_PC_53, _MCW_PC)" means lowering precision
> from 64 to 53-bit mantissa.

Thanks for the information, but I'm still confused.  The above sounds =
like gcc 4.7.2 uses a higher precision (64 bit mantissa) than strtod =
expects (53 bit mantissa), yet in an earlier message you wrote:

> gcc 4.5.2 built version(rubyinstaller version) shows not disired =
result.
> But gcc 4.7.2 and MSVC v16.0 built version shows a correct result.

Not a big problem, I'm just trying to understand things.  Am I =
misreading/misinterpreting things?

> BTW, why we should consider  FP precision?
> When converting string value to double value, ruby calls ruby_strtod
> function instead of native strtod function.
> The ruby_strtod function is based on David M. Gay's netlib library
> which requires double-precision (53-bit) rounding precision.

This raises the question of whether Ruby really supports "the native =
architecture's double-precision floating point representation" as =
described on Float's RDoc.  Does strtod work properly on systems that =
use something other than IEEE 754 binary64 (e.g. VAX)?

>> Is the __MINGW32__ macro enough of a check?  I wonder if it could =
enable
>> the _control87 call on system where it is not present.
>>=20
> Ruby 1.9.x requires Windows 2000 or later OS which requires Pentium =
CPU.
> And most x86 processors since the Intel 80486 have had x87
> instructions implemented in the main CPU.
> I cannot imagine a system with Windows 2000 and not present x87 =
instructions.

There is Windows RT...

http://en.wikipedia.org/wiki/Windows_RT

...but I don't know whether Ruby runs on it. :-)

Dave