+2001-12-09 Benjamin Kosnik <bkoz@redhat.com>
+ Philip Martin <pmartin@uklinux.net>
+
+ * include/bits/locale_facets.h (__num_base::_S_scale_hex): Add.
+ (__num_base::_S_scale_oct): Add.
+ * src/locale.cc: Add definitions.
+ * testsuite/27_io/istream_extractor_arith.cc (main): Call test13.
+
+ * testsuite/testsuite_hooks.h: Remove duplicate VERIFY define.
+
2001-12-07 Nathan Myers <ncm@cantrip.org>
Loren Rittle <ljrittle@acm.org>
// Construct and return valid scanf format for integer types.
static void
_S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl);
+
+ // Used to establish gating factor for base 16 input.
+ static const double _S_scale_hex;
+
+ // Used to establish gating factor for base 8 input.
+ static const double _S_scale_oct;
};
template<typename _CharT>
#include <bits/std_cerrno.h>
#include <bits/std_clocale.h> // For localeconv
#include <bits/std_cstdlib.h> // For strof, strtold
-#include <bits/std_cmath.h> // For ceil
+#include <bits/std_cmath.h> // For ceil
#include <bits/std_limits.h> // For numeric_limits
#include <bits/std_memory.h> // For auto_ptr
#include <bits/streambuf_iterator.h> // For streambuf_iterators
// Figure out the maximum number of digits that can be extracted
// for the given type, using the determined base.
int __max_digits;
- if (__base != 10)
- __max_digits = static_cast<int>(ceil(__max * log(10.0)
- /log(static_cast<double>(__base))));
- else
+ if (__base == 10)
__max_digits = __max;
+ else if (__base == 16)
+ __max_digits = static_cast<int>(ceil(__max * _S_scale_hex));
+ else if (__base == 8)
+ __max_digits = static_cast<int>(ceil(__max * _S_scale_oct));
+
// Add in what's already been extracted.
__max_digits += __pos;
const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF";
+ const double __num_base::_S_scale_hex = log(10.0)/log(16.0);
+
+ const double __num_base::_S_scale_oct = log(10.0)/log(8.0);
+
// Definitions for static const data members of locale::_Impl
const locale::id* const
locale::_Impl::_S_id_ctype[] =
digits += '1';
istringstream iss2(digits);
iss2 >> i;
- VERIFY( iss2.good() );
+ VERIFY( !iss2.fail() );
digits += '1';
i = 0;
test11();
test12();
+ test13();
return 0;
}
# define VERIFY(fn) assert(fn)
#else
# define VERIFY(fn) test &= (fn)
-# define VERIFY(fn) fn
#endif
#include <bits/c++config.h>