Commit 54a60f6e by Andreas Schwab Committed by Jeff Law

iostream.cc (istream::operator>>(long double&)): Scan value into separate…

iostream.cc (istream::operator>>(long double&)): Scan value into separate variable, in case long double is bigger than double.

        * iostream.cc (istream::operator>>(long double&))
        [!_G_HAVE_LONG_DOUBLE_IO]: Scan value into separate variable, in
        case long double is bigger than double.
        (ostream::operator<<(double)) [_G_HAVE_PRINTF_FP]: Fix order of
        initializers of struct printf_info to match declaration order,
        to work around g++ bug.
        (ostream::operator<<(long double)) [_G_HAVE_PRINTF_FP]: Likewise.
        * gen-params: Add missing quotes.  Avoid useless use of command
        substitution.

From-SVN: r17582
parent 6ad85f17
1998-01-20 Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
* iostream.cc (istream::operator>>(long double&))
[!_G_HAVE_LONG_DOUBLE_IO]: Scan value into separate variable, in
case long double is bigger than double.
(ostream::operator<<(double)) [_G_HAVE_PRINTF_FP]: Fix order of
initializers of struct printf_info to match declaration order,
to work around g++ bug.
(ostream::operator<<(long double)) [_G_HAVE_PRINTF_FP]: Likewise.
* gen-params: Add missing quotes. Avoid useless use of command
substitution.
Sun Feb 1 13:29:47 1998 H.J. Lu (hjl@gnu.org) Sun Feb 1 13:29:47 1998 H.J. Lu (hjl@gnu.org)
* filebuf.cc (filebuf::open): Call _IO_file_open if * filebuf.cc (filebuf::open): Call _IO_file_open if
......
...@@ -277,7 +277,7 @@ fi ...@@ -277,7 +277,7 @@ fi
tr ' ' ' ' <TMP >dummy.out tr ' ' ' ' <TMP >dummy.out
for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int16_t uint16_t int32_t uint_32_t u_int16_t u_int32_t; do for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int16_t uint16_t int32_t uint_32_t u_int16_t u_int32_t; do
IMPORTED=`eval 'echo $'"$TYPE"` eval IMPORTED=\$$TYPE
if [ -n "${IMPORTED}" ] ; then if [ -n "${IMPORTED}" ] ; then
eval "$TYPE='$IMPORTED'" eval "$TYPE='$IMPORTED'"
else else
...@@ -318,9 +318,9 @@ done ...@@ -318,9 +318,9 @@ done
# Look for some standard macros. # Look for some standard macros.
for NAME in BUFSIZ FOPEN_MAX FILENAME_MAX NULL; do for NAME in BUFSIZ FOPEN_MAX FILENAME_MAX NULL; do
IMPORTED=`eval 'echo $'"$NAME"` eval IMPORTED=\$$NAME
if [ -n "${IMPORTED}" ] ; then if [ -n "${IMPORTED}" ] ; then
eval "$NAME='$IMPORTED /* specified */" eval "$NAME='$IMPORTED /* specified */'"
else else
rm -f TMP rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\(.*\);|\1|w TMP" \ ${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\(.*\);|\1|w TMP" \
...@@ -334,9 +334,9 @@ done ...@@ -334,9 +334,9 @@ done
# These macros must be numerical constants; strip any trailing 'L's. # These macros must be numerical constants; strip any trailing 'L's.
for NAME in SHRT_MAX INT_MAX LONG_MAX LONG_LONG_MAX; do for NAME in SHRT_MAX INT_MAX LONG_MAX LONG_LONG_MAX; do
IMPORTED=`eval 'echo $'"$NAME"` eval IMPORTED=\$$NAME
if [ -n "${IMPORTED}" ] ; then if [ -n "${IMPORTED}" ] ; then
eval "$NAME='$IMPORTED /* specified */" eval "$NAME='$IMPORTED /* specified */'"
else else
rm -f TMP rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \ ${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \
......
...@@ -333,11 +333,15 @@ READ_INT(bool) ...@@ -333,11 +333,15 @@ READ_INT(bool)
istream& istream::operator>>(long double& x) istream& istream::operator>>(long double& x)
{ {
if (ipfx0()) if (ipfx0())
{
#if _G_HAVE_LONG_DOUBLE_IO #if _G_HAVE_LONG_DOUBLE_IO
scan("%Lg", &x); scan("%Lg", &x);
#else #else
scan("%lg", &x); double y;
scan("%lg", &y);
x = y;
#endif #endif
}
return *this; return *this;
} }
...@@ -628,10 +632,10 @@ ostream& ostream::operator<<(double n) ...@@ -628,10 +632,10 @@ ostream& ostream::operator<<(double n)
left: (flags() & ios::left) != 0, left: (flags() & ios::left) != 0,
showsign: (flags() & ios::showpos) != 0, showsign: (flags() & ios::showpos) != 0,
group: 0, group: 0,
pad: fill()
#if defined __GLIBC__ && __GLIBC__ >= 2 #if defined __GLIBC__ && __GLIBC__ >= 2
, extra: 0 extra: 0,
#endif #endif
pad: fill()
}; };
const void *ptr = (const void *) &n; const void *ptr = (const void *) &n;
if (__printf_fp (rdbuf(), &info, &ptr) < 0) if (__printf_fp (rdbuf(), &info, &ptr) < 0)
...@@ -731,10 +735,10 @@ ostream& ostream::operator<<(long double n) ...@@ -731,10 +735,10 @@ ostream& ostream::operator<<(long double n)
left: (flags() & ios::left) != 0, left: (flags() & ios::left) != 0,
showsign: (flags() & ios::showpos) != 0, showsign: (flags() & ios::showpos) != 0,
group: 0, group: 0,
pad: fill()
#if defined __GLIBC__ && __GLIBC__ >= 2 #if defined __GLIBC__ && __GLIBC__ >= 2
, extra: 0 extra: 0,
#endif #endif
pad: fill()
}; };
const void *ptr = (const void *) &n; const void *ptr = (const void *) &n;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment