Floating Point + Threads?
Robert Jacques
sandford at jhu.edu
Tue Apr 19 20:02:10 PDT 2011
On Tue, 19 Apr 2011 14:18:46 -0400, Sean Kelly <sean at invisibleduck.org>
wrote:
> On Apr 16, 2011, at 1:02 PM, Robert Jacques wrote:
>
>> On Sat, 16 Apr 2011 15:32:12 -0400, Walter Bright
>> <newshound2 at digitalmars.com> wrote:
>>>
>>>
>>> The dmd startup code (actually the C startup code) does an fninit. I
>>> never thought about new thread starts. So, yeah, druntime should do an
>>> fninit on thread creation.
>>
>> The documentation I've found on fninit seems to indicate it defaults to
>> 64-bit precision, which means that by default we aren't seeing the
>> benefit of D's reals. I'd much prefer 80-bit precision by default.
>
> There is no option to set "80-bit precision" via the FPU control word.
> Section 8.1.5.2 of the Intel 64 SDM says the following:
>
> "The precision-control (PC) field (bits 8 and 9 of the x87 FPU control
> word) determines the precision (64, 53, or 24 bits) of floating-point
> calculations made by the x87 FPU (see Table 8-2). The default precision
> is double extended precision, which uses the full 64-bit significand
> available with the double extended-precision floating-point format of
> the x87 FPU data registers. This setting is best suited for most
> applications, because it allows applications to take full advantage of
> the maximum precision available with the x87 FPU data registers."
>
> So it sounds like finit/fninit does what we want.
Yes, that sounds right. Thanks for clarifying.
More information about the Digitalmars-d
mailing list