[PATCH] libstdc++/5045: wrong numeric_limits::digits10 forinteger types
Paolo Carlini
pcarlini@unitus.it
Fri Dec 7 16:38:00 GMT 2001
Benjamin Kosnik wrote:
> > May I apply the following patch?
>
> Please wait for Gaby to ok and make a test case please.
Ok.
In case Gaby ok the patch this is what I propose for the testsuite.
Cheers,
Paolo.
//////////////
--- numeric_limits.cc.orig Sat Dec 8 01:25:59 2001
+++ numeric_limits.cc Sat Dec 8 01:32:11 2001
@@ -155,10 +155,31 @@ void test02()
const bool* pb1 = &b_nl_type::traps;
}
+// libstdc++/5045
+bool test03()
+{
+ bool test = true;
+
+ VERIFY( __glibcpp_s8_digits10 == 2 );
+ VERIFY( __glibcpp_u8_digits10 == 2 );
+ VERIFY( __glibcpp_s16_digits10 == 4 );
+ VERIFY( __glibcpp_u16_digits10 == 4 );
+ VERIFY( __glibcpp_s32_digits10 == 9 );
+ VERIFY( __glibcpp_u32_digits10 == 9 );
+ VERIFY( __glibcpp_s64_digits10 == 18 );
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
int main()
{
test01();
test02();
+ test03();
test_extrema<char>();
test_extrema<signed char>();
More information about the Libstdc++
mailing list