+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.
// -*- 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
#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__)
// 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)