On Tuesday, 25 August 2015 at 21:30:03 UTC, Warwick wrote:

The compilers that dont exhibit this problem might set the x87 to work at 64 bit at startup or more likely they are using scalar SSE. You cant mix different depth operands in SSE. You cant multiply a float by double for example, you have to convert one of them so they have the same type. So in SSE the bit depth of every op is always explicit.

True word:

This is msvc compiler generated code (default configuration, debug):

    double x = 1.2;
012F174E  movsd       xmm0,mmword ptr ds:[12F6B30h]
012F1756  movsd       mmword ptr [x],xmm0
    unsigned long long u = (unsigned long long)(x * 10);
012F175B  movsd       xmm0,mmword ptr [x]
012F1760  mulsd       xmm0,mmword ptr ds:[12F6B40h]
012F1768  call        __dtoul3 (012F102Dh)
012F176D  mov         dword ptr [u],eax
012F1770  mov         dword ptr [ebp-18h],edx


Reply via email to