mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Drop support for MSVCRT's float formatting quirk.
Commitf1885386added code to remove an unnecessary leading zero from the exponent in a float formatted by the system snprintf(). The C standard doesn't allow unnecessary digits beyond two, and the tests pass without this on Windows' modern UCRT (required since commit1758d424). Discussion: https://postgr.es/m/CA%2BhUKGJnmzTqiODmTjf-23yZ%3DE3HXqFTtKoyp3TF-MpB93hTMQ%40mail.gmail.com
This commit is contained in:
@@ -1205,22 +1205,6 @@ fmtfloat(double value, char type, int forcesign, int leftjust,
|
|||||||
}
|
}
|
||||||
if (vallen < 0)
|
if (vallen < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/*
|
|
||||||
* Windows, alone among our supported platforms, likes to emit
|
|
||||||
* three-digit exponent fields even when two digits would do. Hack
|
|
||||||
* such results to look like the way everyone else does it.
|
|
||||||
*/
|
|
||||||
#ifdef WIN32
|
|
||||||
if (vallen >= 6 &&
|
|
||||||
convert[vallen - 5] == 'e' &&
|
|
||||||
convert[vallen - 3] == '0')
|
|
||||||
{
|
|
||||||
convert[vallen - 3] = convert[vallen - 2];
|
|
||||||
convert[vallen - 2] = convert[vallen - 1];
|
|
||||||
vallen--;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
padlen = compute_padlen(minlen, vallen + zeropadlen, leftjust);
|
padlen = compute_padlen(minlen, vallen + zeropadlen, leftjust);
|
||||||
@@ -1336,17 +1320,6 @@ pg_strfromd(char *str, size_t count, int precision, double value)
|
|||||||
target.failed = true;
|
target.failed = true;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
if (vallen >= 6 &&
|
|
||||||
convert[vallen - 5] == 'e' &&
|
|
||||||
convert[vallen - 3] == '0')
|
|
||||||
{
|
|
||||||
convert[vallen - 3] = convert[vallen - 2];
|
|
||||||
convert[vallen - 2] = convert[vallen - 1];
|
|
||||||
vallen--;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user