Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (Level 3) C4738
Collapse the table of content
Expand the table of content

Compiler Warning (Level 3) C4738

Error Message

storing 32-bit float result in memory, possible loss of performance

C4738 warns that the result of an assignment, cast, passed argument, or other operation may need to be rounded or that the operation ran out of registers and needed to use memory (spilling). This can result in performance loss.

To resolve this warning and avoid rounding, compile with /fp:fast or use doubles instead of floats.

To resolve this warning and avoid running out of registers, change the order of computation and modify your use of inlining

This warning is off by default. For more information, see Compiler Warnings That Are Off by Default.


The following sample generates C4738:

// C4738.cpp
// compile with: /c /fp:precise /O2 /W3
// processor: x86
#include <stdio.h>

#pragma warning(default : 4738)

float func(float f)
    return f;

int main()
    extern float f, f1, f2;
    double d = 0.0;

    f1 = func(d);
    f2 = (float) d;
    f = f1 + f2;   // C4738
    printf_s("%f\n", f);

Community Additions

© 2015 Microsoft