aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-11-03 17:33:54 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-11-03 17:33:54 +0000
commitdd60dacdc52499c73ee329d86e1918ccd35fd9e3 (patch)
tree67df1a4a2447adf81cc885a1bb33e8ad324da982 /libstdc++-v3
parentfdb8b4c025aaec6ef208c0af698cc3faa87d15dd (diff)
downloadgcc-dd60dacdc52499c73ee329d86e1918ccd35fd9e3.zip
gcc-dd60dacdc52499c73ee329d86e1918ccd35fd9e3.tar.gz
gcc-dd60dacdc52499c73ee329d86e1918ccd35fd9e3.tar.bz2
limits (__glibcxx_digits10, [...]): Use 643L instead of 643 to avoid overflows on 16-bit machines.
2010-11-03 Paolo Carlini <paolo.carlini@oracle.com> * include/std/limits (__glibcxx_digits10, __glibcxx_max_digits10): Use 643L instead of 643 to avoid overflows on 16-bit machines. * include/ext/numeric_traits.h (__glibcxx_max_digits10): Likewise. From-SVN: r166261
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/ext/numeric_traits.h4
-rw-r--r--libstdc++-v3/include/std/limits4
3 files changed, 10 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0b7d3c2..cc03f49 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/limits (__glibcxx_digits10, __glibcxx_max_digits10):
+ Use 643L instead of 643 to avoid overflows on 16-bit machines.
+ * include/ext/numeric_traits.h (__glibcxx_max_digits10): Likewise.
+
2010-11-02 Benjamin Kosnik <bkoz@redhat.com>
* include/std/chrono: Use typedefs.
diff --git a/libstdc++-v3/include/ext/numeric_traits.h b/libstdc++-v3/include/ext/numeric_traits.h
index 57fcf9c..ab66a49 100644
--- a/libstdc++-v3/include/ext/numeric_traits.h
+++ b/libstdc++-v3/include/ext/numeric_traits.h
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
#define __glibcxx_max_digits10(_Tp) \
(2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
- __LDBL_MANT_DIG__) * 3010 / 10000)
+ __LDBL_MANT_DIG__) * 643L / 2136)
#define __glibcxx_digits10(_Tp) \
__glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index ce557d6..4594c93 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -140,10 +140,10 @@
// The fraction 643/2136 approximates log10(2) to 7 significant digits.
#define __glibcxx_digits10(T) \
- (__glibcxx_digits (T) * 643 / 2136)
+ (__glibcxx_digits (T) * 643L / 2136)
#define __glibcxx_max_digits10(T) \
- (2 + (T) * 643 / 2136)
+ (2 + (T) * 643L / 2136)
_GLIBCXX_BEGIN_NAMESPACE(std)