Floating Point + Threads?

Robert Jacques sandford at jhu.edu
Sat Apr 16 13:02:58 PDT 2011


On Sat, 16 Apr 2011 15:32:12 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 4/16/2011 11:51 AM, Sean Kelly wrote:
>>
>> On Apr 16, 2011, at 11:43 AM, dsimcha wrote:
>>>>
>>>> Close: If I add this instruction to the function for the new thread,  
>>>> the
>>>> difference goes away. The relevant statement is:
>>>>
>>>> auto t = new Thread( { asm { fninit; } res2 = sumRange(terms); } );
>>>>
>>>> At any rate, this is a **huge** WTF that should probably be fixed in
>>>> druntime. Once I understand it a little better, I'll file a bug  
>>>> report.
>>>
>>> Read up a little on what fninit does, etc.  This is IMHO a druntime  
>>> bug.
>>> Filed as http://d.puremagic.com/issues/show_bug.cgi?id=5847 .
>>
>> Really a Windows bug that should be fixed in druntime :-)  I know I'm
>> splitting hairs.  This will be fixed for the next release.
>
>
> 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.


More information about the Digitalmars-d mailing list