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
This commit is contained in:
parent
fdb8b4c025
commit
dd60dacdc5
|
@ -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>
|
2010-11-02 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* include/std/chrono: Use typedefs.
|
* include/std/chrono: Use typedefs.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- 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
|
// 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
|
// 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) \
|
#define __glibcxx_max_digits10(_Tp) \
|
||||||
(2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
|
(2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
|
||||||
__LDBL_MANT_DIG__) * 3010 / 10000)
|
__LDBL_MANT_DIG__) * 643L / 2136)
|
||||||
|
|
||||||
#define __glibcxx_digits10(_Tp) \
|
#define __glibcxx_digits10(_Tp) \
|
||||||
__glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
|
__glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
|
||||||
|
|
|
@ -140,10 +140,10 @@
|
||||||
|
|
||||||
// The fraction 643/2136 approximates log10(2) to 7 significant digits.
|
// The fraction 643/2136 approximates log10(2) to 7 significant digits.
|
||||||
#define __glibcxx_digits10(T) \
|
#define __glibcxx_digits10(T) \
|
||||||
(__glibcxx_digits (T) * 643 / 2136)
|
(__glibcxx_digits (T) * 643L / 2136)
|
||||||
|
|
||||||
#define __glibcxx_max_digits10(T) \
|
#define __glibcxx_max_digits10(T) \
|
||||||
(2 + (T) * 643 / 2136)
|
(2 + (T) * 643L / 2136)
|
||||||
|
|
||||||
_GLIBCXX_BEGIN_NAMESPACE(std)
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue