Skip to content

Commit

Permalink
Use alternative format (#111444)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jan 30, 2025
1 parent 62d433f commit 99b4e84
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/coreclr/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr,
for(n=0; n < numElements; n++)
{
if(n) appendStr(out," ");
sprintf_s(str, 64, "%.*g", 8, (double)(*((float*)dataPtr)));
sprintf_s(str, 64, "%#.8g", (double)(*((float*)dataPtr)));
float df = (float)atof(str);
// Must compare as underlying bytes, not floating point otherwise optimizer will
// try to enregister and compare 80-bit precision number with 32-bit precision number!!!!
Expand All @@ -1933,7 +1933,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr,
{
if(n) appendStr(out," ");
char *pch;
sprintf_s(str, 64, "%.*g", 17, *((double*)dataPtr));
sprintf_s(str, 64, "%#.17g", *((double*)dataPtr));
double df = strtod(str, &pch);
// Must compare as underlying bytes, not floating point otherwise optimizer will
// try to enregister and compare 80-bit precision number with 64-bit precision number!!!!
Expand Down Expand Up @@ -2605,7 +2605,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void
case ELEMENT_TYPE_R4:
{
char szf[32];
sprintf_s(szf, 32, "%.*g", 8, (double)MDDV.m_fltValue);
sprintf_s(szf, 32, "%#.8g", (double)MDDV.m_fltValue);
float df = (float)atof(szf);
// Must compare as underlying bytes, not floating point otherwise optimizer will
// try to enregister and compare 80-bit precision number with 32-bit precision number!!!!
Expand All @@ -2619,7 +2619,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void
case ELEMENT_TYPE_R8:
{
char szf[32], *pch;
sprintf_s(szf, 32, "%.*g", 17, MDDV.m_dblValue);
sprintf_s(szf, 32, "%#.17g", MDDV.m_dblValue);
double df = strtod(szf, &pch); //atof(szf);
szf[31]=0;
// Must compare as underlying bytes, not floating point otherwise optimizer will
Expand Down

0 comments on commit 99b4e84

Please # to comment.