// The template and inlines for the -*- C++ -*- numeric_limits classes.
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005
+// 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
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
+/** @file limits
+ * This is a Standard C++ Library header.
+ */
+
// Note: this is not a conforming implementation.
// Written by Gabriel Dos Reis <gdr@codesourcery.com>
// 18.2.1
//
-/** @file limits
- * This is a Standard C++ Library header. You should @c #include this header
- * in your programs, rather than any of the "st[dl]_*.h" implementation files.
- */
-
-#ifndef _CPP_NUMERIC_LIMITS
-#define _CPP_NUMERIC_LIMITS 1
+#ifndef _GLIBCXX_NUMERIC_LIMITS
+#define _GLIBCXX_NUMERIC_LIMITS 1
#pragma GCC system_header
-#include <bits/cpu_limits.h>
#include <bits/c++config.h>
//
// double (1)
// long double (1)
//
-// GNU C++ undertstands (where supported by the host C-library)
+// GNU C++ undertstands (where supported by the host C-library)
// * integer
// long long, unsigned long long (2)
//
// which brings us to 15 fundamental arithmetic data types in GNU C++.
//
-//
+//
// Since a numeric_limits<> is a bit tricky to get right, we rely on
// an interface composed of macros which should be defined in config/os
// or config/cpu when they differ from the generic (read arbitrary)
// definitions given here.
//
-#ifdef __CHAR_UNSIGNED__
-# define __glibcpp_plain_char_is_signed false
-#else
-# define __glibcpp_plain_char_is_signed true
-#endif
-
-#ifndef __WCHAR_UNSIGNED__
-# define __glibcpp_wchar_t_is_signed false
-#else
-# define __glibcpp_wchar_t_is_signed true
-#endif
-
// These values can be overridden in the target configuration file.
// The default values are appropriate for many 32-bit targets.
// GCC only intrinsicly supports modulo integral types. The only remaining
// integral exceptional values is division by zero. Only targets that do not
// signal division by zero in some "hard to ignore" way should use false.
-#ifndef __glibcpp_integral_traps
-# define __glibcpp_integral_traps true
-#endif
-
-// You should not need to define any macros below this point, unless
-// you have a machine with non-standard bit-widths.
-
-// These values are the minimums and maximums for standard data types
-// of common widths.
-
-#define __glibcpp_s8_max 127
-#define __glibcpp_s8_min (-__glibcpp_s8_max - 1)
-#define __glibcpp_s8_digits 7
-#define __glibcpp_s8_digits10 2
-#define __glibcpp_u8_min 0U
-#define __glibcpp_u8_max (__glibcpp_s8_max * 2 + 1)
-#define __glibcpp_u8_digits 8
-#define __glibcpp_u8_digits10 2
-#define __glibcpp_s16_max 32767
-#define __glibcpp_s16_min (-__glibcpp_s16_max - 1)
-#define __glibcpp_s16_digits 15
-#define __glibcpp_s16_digits10 4
-#define __glibcpp_u16_min 0U
-#define __glibcpp_u16_max (__glibcpp_s16_max * 2 + 1)
-#define __glibcpp_u16_digits 16
-#define __glibcpp_u16_digits10 4
-#define __glibcpp_s32_max 2147483647L
-#define __glibcpp_s32_min (-__glibcpp_s32_max - 1)
-#define __glibcpp_s32_digits 31
-#define __glibcpp_s32_digits10 9
-#define __glibcpp_u32_min 0UL
-#define __glibcpp_u32_max (__glibcpp_s32_max * 2U + 1)
-#define __glibcpp_u32_digits 32
-#define __glibcpp_u32_digits10 9
-#define __glibcpp_s64_max 9223372036854775807LL
-#define __glibcpp_s64_min (-__glibcpp_s64_max - 1)
-#define __glibcpp_s64_digits 63
-#define __glibcpp_s64_digits10 18
-#define __glibcpp_u64_min 0ULL
-#define __glibcpp_u64_max (__glibcpp_s64_max * 2ULL + 1)
-#define __glibcpp_u64_digits 64
-#define __glibcpp_u64_digits10 19
-
-// bool-specific hooks:
-// __glibcpp_bool_digits
-
-#ifndef __glibcpp_bool_digits
-# define __glibcpp_bool_digits 1
-#endif
-
-// char.
-
-#if __CHAR_BIT__ == 8
-# define __glibcpp_signed_char_min __glibcpp_s8_min
-# define __glibcpp_signed_char_max __glibcpp_s8_max
-# define __glibcpp_signed_char_digits __glibcpp_s8_digits
-# define __glibcpp_signed_char_digits10 __glibcpp_s8_digits10
-# define __glibcpp_unsigned_char_min __glibcpp_u8_min
-# define __glibcpp_unsigned_char_max __glibcpp_u8_max
-# define __glibcpp_unsigned_char_digits __glibcpp_u8_digits
-# define __glibcpp_unsigned_char_digits10 __glibcpp_u8_digits10
-#elif __CHAR_BIT__ == 16
-# define __glibcpp_signed_char_min __glibcpp_s16_min
-# define __glibcpp_signed_char_max __glibcpp_s16_max
-# define __glibcpp_signed_char_digits __glibcpp_s16_digits
-# define __glibcpp_signed_char_digits10 __glibcpp_s16_digits10
-# define __glibcpp_unsigned_char_min __glibcpp_u16_min
-# define __glibcpp_unsigned_char_max __glibcpp_u16_max
-# define __glibcpp_unsigned_char_digits __glibcpp_u16_digits
-# define __glibcpp_unsigned_char_digits10 __glibcpp_u16_digits10
-#elif __CHAR_BIT__ == 32
-# define __glibcpp_signed_char_min (signed char)__glibcpp_s32_min
-# define __glibcpp_signed_char_max (signed char)__glibcpp_s32_max
-# define __glibcpp_signed_char_digits __glibcpp_s32_digits
-# define __glibcpp_signed_char_digits10 __glibcpp_s32_digits10
-# define __glibcpp_unsigned_char_min (unsigned char)__glibcpp_u32_min
-# define __glibcpp_unsigned_char_max (unsigned char)__glibcpp_u32_max
-# define __glibcpp_unsigned_char_digits __glibcpp_u32_digits
-# define __glibcpp_unsigned_char_digits10 __glibcpp_u32_digits10
-#elif __CHAR_BIT__ == 64
-# define __glibcpp_signed_char_min (signed char)__glibcpp_s64_min
-# define __glibcpp_signed_char_max (signed char)__glibcpp_s64_max
-# define __glibcpp_signed_char_digits __glibcpp_s64_digits
-# define __glibcpp_signed_char_digits10 __glibcpp_s64_digits10
-# define __glibcpp_unsigned_char_min (unsigned char)__glibcpp_u64_min
-# define __glibcpp_unsigned_char_max (unsigned char)__glibcpp_u64_max
-# define __glibcpp_unsigned_char_digits __glibcpp_u64_digits
-# define __glibcpp_unsigned_char_digits10 __glibcpp_u64_digits10
-#else
-// You must define these macros in the configuration file.
-#endif
-
-#if __glibcpp_plain_char_is_signed
-# define __glibcpp_char_min (char)__glibcpp_signed_char_min
-# define __glibcpp_char_max (char)__glibcpp_signed_char_max
-# define __glibcpp_char_digits __glibcpp_signed_char_digits
-# define __glibcpp_char_digits10 __glibcpp_signed_char_digits
-#else
-# define __glibcpp_char_min (char)__glibcpp_unsigned_char_min
-# define __glibcpp_char_max (char)__glibcpp_unsigned_char_max
-# define __glibcpp_char_digits __glibcpp_unsigned_char_digits
-# define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits
-#endif
-
-// short
-
-#if __SHRT_BIT__ == 8
-# define __glibcpp_signed_short_min __glibcpp_s8_min
-# define __glibcpp_signed_short_max __glibcpp_s8_max
-# define __glibcpp_signed_short_digits __glibcpp_s8_digits
-# define __glibcpp_signed_short_digits10 __glibcpp_s8_digits10
-# define __glibcpp_unsigned_short_min __glibcpp_u8_min
-# define __glibcpp_unsigned_short_max __glibcpp_u8_max
-# define __glibcpp_unsigned_short_digits __glibcpp_u8_digits
-# define __glibcpp_unsigned_short_digits10 __glibcpp_u8_digits10
-#elif __SHRT_BIT__ == 16
-# define __glibcpp_signed_short_min __glibcpp_s16_min
-# define __glibcpp_signed_short_max __glibcpp_s16_max
-# define __glibcpp_signed_short_digits __glibcpp_s16_digits
-# define __glibcpp_signed_short_digits10 __glibcpp_s16_digits10
-# define __glibcpp_unsigned_short_min __glibcpp_u16_min
-# define __glibcpp_unsigned_short_max __glibcpp_u16_max
-# define __glibcpp_unsigned_short_digits __glibcpp_u16_digits
-# define __glibcpp_unsigned_short_digits10 __glibcpp_u16_digits10
-#elif __SHRT_BIT__ == 32
-# define __glibcpp_signed_short_min (short)__glibcpp_s32_min
-# define __glibcpp_signed_short_max (short)__glibcpp_s32_max
-# define __glibcpp_signed_short_digits __glibcpp_s32_digits
-# define __glibcpp_signed_short_digits10 __glibcpp_s32_digits10
-# define __glibcpp_unsigned_short_min (unsigned short)__glibcpp_u32_min
-# define __glibcpp_unsigned_short_max (unsigned short)__glibcpp_u32_max
-# define __glibcpp_unsigned_short_digits __glibcpp_u32_digits
-# define __glibcpp_unsigned_short_digits10 __glibcpp_u32_digits10
-#elif __SHRT_BIT__ == 64
-# define __glibcpp_signed_short_min (short)__glibcpp_s64_min
-# define __glibcpp_signed_short_max (short)__glibcpp_s64_max
-# define __glibcpp_signed_short_digits __glibcpp_s64_digits
-# define __glibcpp_signed_short_digits10 __glibcpp_s64_digits10
-# define __glibcpp_unsigned_short_min (unsigned short)__glibcpp_u64_min
-# define __glibcpp_unsigned_short_max (unsigned short)__glibcpp_u64_max
-# define __glibcpp_unsigned_short_digits __glibcpp_u64_digits
-# define __glibcpp_unsigned_short_digits10 __glibcpp_u64_digits10
-#else
-// You must define these macros in the configuration file.
-#endif
-
-// int
-
-#if __INT_BIT__ == 8
-# define __glibcpp_signed_int_min __glibcpp_s8_min
-# define __glibcpp_signed_int_max __glibcpp_s8_max
-# define __glibcpp_signed_int_digits __glibcpp_s8_digits
-# define __glibcpp_signed_int_digits10 __glibcpp_s8_digits10
-# define __glibcpp_unsigned_int_min __glibcpp_u8_min
-# define __glibcpp_unsigned_int_max __glibcpp_u8_max
-# define __glibcpp_unsigned_int_digits __glibcpp_u8_digits
-# define __glibcpp_unsigned_int_digits10 __glibcpp_u8_digits10
-#elif __INT_BIT__ == 16
-# define __glibcpp_signed_int_min __glibcpp_s16_min
-# define __glibcpp_signed_int_max __glibcpp_s16_max
-# define __glibcpp_signed_int_digits __glibcpp_s16_digits
-# define __glibcpp_signed_int_digits10 __glibcpp_s16_digits10
-# define __glibcpp_unsigned_int_min __glibcpp_u16_min
-# define __glibcpp_unsigned_int_max __glibcpp_u16_max
-# define __glibcpp_unsigned_int_digits __glibcpp_u16_digits
-# define __glibcpp_unsigned_int_digits10 __glibcpp_u16_digits10
-#elif __INT_BIT__ == 32
-# define __glibcpp_signed_int_min (int)__glibcpp_s32_min
-# define __glibcpp_signed_int_max (int)__glibcpp_s32_max
-# define __glibcpp_signed_int_digits __glibcpp_s32_digits
-# define __glibcpp_signed_int_digits10 __glibcpp_s32_digits10
-# define __glibcpp_unsigned_int_min (unsigned)__glibcpp_u32_min
-# define __glibcpp_unsigned_int_max (unsigned)__glibcpp_u32_max
-# define __glibcpp_unsigned_int_digits __glibcpp_u32_digits
-# define __glibcpp_unsigned_int_digits10 __glibcpp_u32_digits10
-#elif __INT_BIT__ == 64
-# define __glibcpp_signed_int_min (int)__glibcpp_s64_min
-# define __glibcpp_signed_int_max (int)__glibcpp_s64_max
-# define __glibcpp_signed_int_digits __glibcpp_s64_digits
-# define __glibcpp_signed_int_digits10 __glibcpp_s64_digits10
-# define __glibcpp_unsigned_int_min (unsigned)__glibcpp_u64_min
-# define __glibcpp_unsigned_int_max (unsigned)__glibcpp_u64_max
-# define __glibcpp_unsigned_int_digits __glibcpp_u64_digits
-# define __glibcpp_unsigned_int_digits10 __glibcpp_u64_digits10
-#else
-// You must define these macros in the configuration file.
-#endif
-
-// long
-
-#if __LONG_BIT__ == 8
-# define __glibcpp_signed_long_min __glibcpp_s8_min
-# define __glibcpp_signed_long_max __glibcpp_s8_max
-# define __glibcpp_signed_long_digits __glibcpp_s8_digits
-# define __glibcpp_signed_long_digits10 __glibcpp_s8_digits10
-# define __glibcpp_unsigned_long_min __glibcpp_u8_min
-# define __glibcpp_unsigned_long_max __glibcpp_u8_max
-# define __glibcpp_unsigned_long_digits __glibcpp_u8_digits
-# define __glibcpp_unsigned_long_digits10 __glibcpp_u8_digits10
-#elif __LONG_BIT__ == 16
-# define __glibcpp_signed_long_min __glibcpp_s16_min
-# define __glibcpp_signed_long_max __glibcpp_s16_max
-# define __glibcpp_signed_long_digits __glibcpp_s16_digits
-# define __glibcpp_signed_long_digits10 __glibcpp_s16_digits10
-# define __glibcpp_unsigned_long_min __glibcpp_u16_min
-# define __glibcpp_unsigned_long_max __glibcpp_u16_max
-# define __glibcpp_unsigned_long_digits __glibcpp_u16_digits
-# define __glibcpp_unsigned_long_digits10 __glibcpp_u16_digits10
-#elif __LONG_BIT__ == 32
-# define __glibcpp_signed_long_min __glibcpp_s32_min
-# define __glibcpp_signed_long_max __glibcpp_s32_max
-# define __glibcpp_signed_long_digits __glibcpp_s32_digits
-# define __glibcpp_signed_long_digits10 __glibcpp_s32_digits10
-# define __glibcpp_unsigned_long_min __glibcpp_u32_min
-# define __glibcpp_unsigned_long_max __glibcpp_u32_max
-# define __glibcpp_unsigned_long_digits __glibcpp_u32_digits
-# define __glibcpp_unsigned_long_digits10 __glibcpp_u32_digits10
-#elif __LONG_BIT__ == 64
-# define __glibcpp_signed_long_min (long)__glibcpp_s64_min
-# define __glibcpp_signed_long_max (long)__glibcpp_s64_max
-# define __glibcpp_signed_long_digits __glibcpp_s64_digits
-# define __glibcpp_signed_long_digits10 __glibcpp_s64_digits10
-# define __glibcpp_unsigned_long_min (unsigned long)__glibcpp_u64_min
-# define __glibcpp_unsigned_long_max (unsigned long)__glibcpp_u64_max
-# define __glibcpp_unsigned_long_digits __glibcpp_u64_digits
-# define __glibcpp_unsigned_long_digits10 __glibcpp_u64_digits10
-#else
-// You must define these macros in the configuration file.
-#endif
-
-// long long
-
-#if __LONG_LONG_BIT__ == 8
-# define __glibcpp_signed_long_long_min __glibcpp_s8_min
-# define __glibcpp_signed_long_long_max __glibcpp_s8_max
-# define __glibcpp_signed_long_long_digits __glibcpp_s8_digits
-# define __glibcpp_signed_long_long_digits10 __glibcpp_s8_digits10
-# define __glibcpp_unsigned_long_long_min __glibcpp_u8_min
-# define __glibcpp_unsigned_long_long_max __glibcpp_u8_max
-# define __glibcpp_unsigned_long_long_digits __glibcpp_u8_digits
-# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u8_digits10
-#elif __LONG_LONG_BIT__ == 16
-# define __glibcpp_signed_long_long_min __glibcpp_s16_min
-# define __glibcpp_signed_long_long_max __glibcpp_s16_max
-# define __glibcpp_signed_long_long_digits __glibcpp_s16_digits
-# define __glibcpp_signed_long_long_digits10 __glibcpp_s16_digits10
-# define __glibcpp_unsigned_long_long_min __glibcpp_u16_min
-# define __glibcpp_unsigned_long_long_max __glibcpp_u16_max
-# define __glibcpp_unsigned_long_long_digits __glibcpp_u16_digits
-# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u16_digits10
-#elif __LONG_LONG_BIT__ == 32
-# define __glibcpp_signed_long_long_min __glibcpp_s32_min
-# define __glibcpp_signed_long_long_max __glibcpp_s32_max
-# define __glibcpp_signed_long_long_digits __glibcpp_s32_digits
-# define __glibcpp_signed_long_long_digits10 __glibcpp_s32_digits10
-# define __glibcpp_unsigned_long_long_min __glibcpp_u32_min
-# define __glibcpp_unsigned_long_long_max __glibcpp_u32_max
-# define __glibcpp_unsigned_long_long_digits __glibcpp_u32_digits
-# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u32_digits10
-#elif __LONG_LONG_BIT__ == 64
-# define __glibcpp_signed_long_long_min __glibcpp_s64_min
-# define __glibcpp_signed_long_long_max __glibcpp_s64_max
-# define __glibcpp_signed_long_long_digits __glibcpp_s64_digits
-# define __glibcpp_signed_long_long_digits10 __glibcpp_s64_digits10
-# define __glibcpp_unsigned_long_long_min __glibcpp_u64_min
-# define __glibcpp_unsigned_long_long_max __glibcpp_u64_max
-# define __glibcpp_unsigned_long_long_digits __glibcpp_u64_digits
-# define __glibcpp_unsigned_long_long_digits10 __glibcpp_u64_digits10
-#else
-// You must define these macros in the configuration file.
-#endif
-
-// wchar_t
-
-#if __glibcpp_wchar_t_is_signed
-# if __WCHAR_BIT__ == 8
-# define __glibcpp_wchar_t_min __glibcpp_s8_min
-# define __glibcpp_wchar_t_max __glibcpp_s8_max
-# define __glibcpp_wchar_t_digits __glibcpp_s8_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_s8_digits10
-# elif __WCHAR_BIT__ == 16
-# define __glibcpp_wchar_t_min __glibcpp_s16_min
-# define __glibcpp_wchar_t_max __glibcpp_s16_max
-# define __glibcpp_wchar_t_digits __glibcpp_s16_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_s16_digits10
-# elif __WCHAR_BIT__ == 32
-# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_s32_min
-# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_s32_max
-# define __glibcpp_wchar_t_digits __glibcpp_s32_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_s32_digits10
-# elif __WCHAR_BIT__ == 64
-# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_s64_min
-# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_s64_max
-# define __glibcpp_wchar_t_digits __glibcpp_s64_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_s64_digits10
-# else
-// You must define these macros in the configuration file.
-# endif
-#else
-# if __WCHAR_BIT__ == 8
-# define __glibcpp_wchar_t_min __glibcpp_u8_min
-# define __glibcpp_wchar_t_max __glibcpp_u8_max
-# define __glibcpp_wchar_t_digits __glibcpp_u8_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_u8_digits10
-# elif __WCHAR_BIT__ == 16
-# define __glibcpp_wchar_t_min __glibcpp_u16_min
-# define __glibcpp_wchar_t_max __glibcpp_u16_max
-# define __glibcpp_wchar_t_digits __glibcpp_u16_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_u16_digits10
-# elif __WCHAR_BIT__ == 32
-# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_u32_min
-# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_u32_max
-# define __glibcpp_wchar_t_digits __glibcpp_u32_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_u32_digits10
-# elif __WCHAR_BIT__ == 64
-# define __glibcpp_wchar_t_min (wchar_t)__glibcpp_u64_min
-# define __glibcpp_wchar_t_max (wchar_t)__glibcpp_u64_max
-# define __glibcpp_wchar_t_digits __glibcpp_u64_digits
-# define __glibcpp_wchar_t_digits10 __glibcpp_u64_digits10
-# else
-// You must define these macros in the configuration file.
-# endif
+#ifndef __glibcxx_integral_traps
+# define __glibcxx_integral_traps true
#endif
// float
// Default values. Should be overriden in configuration files if necessary.
-#ifndef __glibcpp_float_has_denorm_loss
-# define __glibcpp_float_has_denorm_loss false
-#endif
-
-#ifndef __glibcpp_float_is_modulo
-# define __glibcpp_float_is_modulo false
+#ifndef __glibcxx_float_has_denorm_loss
+# define __glibcxx_float_has_denorm_loss false
#endif
-
-#ifndef __glibcpp_float_traps
-# define __glibcpp_float_traps false
+#ifndef __glibcxx_float_traps
+# define __glibcxx_float_traps false
#endif
-
-#ifndef __glibcpp_float_tinyness_before
-# define __glibcpp_float_tinyness_before false
+#ifndef __glibcxx_float_tinyness_before
+# define __glibcxx_float_tinyness_before false
#endif
// double
// Default values. Should be overriden in configuration files if necessary.
-#ifndef __glibcpp_double_has_denorm_loss
-# define __glibcpp_double_has_denorm_loss false
+#ifndef __glibcxx_double_has_denorm_loss
+# define __glibcxx_double_has_denorm_loss false
#endif
-
-#ifndef __glibcpp_double_is_modulo
-# define __glibcpp_double_is_modulo false
+#ifndef __glibcxx_double_traps
+# define __glibcxx_double_traps false
#endif
-
-#ifndef __glibcpp_double_traps
-# define __glibcpp_double_traps false
-#endif
-
-#ifndef __glibcpp_double_tinyness_before
-# define __glibcpp_double_tinyness_before false
+#ifndef __glibcxx_double_tinyness_before
+# define __glibcxx_double_tinyness_before false
#endif
// long double
// Default values. Should be overriden in configuration files if necessary.
-#ifndef __glibcpp_long_double_has_denorm_loss
-# define __glibcpp_long_double_has_denorm_loss false
+#ifndef __glibcxx_long_double_has_denorm_loss
+# define __glibcxx_long_double_has_denorm_loss false
#endif
-
-#ifndef __glibcpp_long_double_is_modulo
-# define __glibcpp_long_double_is_modulo false
+#ifndef __glibcxx_long_double_traps
+# define __glibcxx_long_double_traps false
#endif
-
-#ifndef __glibcpp_long_double_traps
-# define __glibcpp_long_double_traps false
+#ifndef __glibcxx_long_double_tinyness_before
+# define __glibcxx_long_double_tinyness_before false
#endif
-#ifndef __glibcpp_long_double_tinyness_before
-# define __glibcpp_long_double_tinyness_before false
-#endif
+// You should not need to define any macros below this point.
+
+#define __glibcxx_signed(T) ((T)(-1) < 0)
+
+#define __glibcxx_min(T) \
+ (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
+
+#define __glibcxx_max(T) \
+ (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0)
+
+#define __glibcxx_digits(T) \
+ (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
+
+// The fraction 643/2136 approximates log10(2) to 7 significant digits.
+#define __glibcxx_digits10(T) \
+ (__glibcxx_digits (T) * 643 / 2136)
namespace std
{
- // This is better handled by the compiler, but we do it here for the
- // time being. (We're just second-guessing something the compiler
- // knows about better than we do.) -- Gaby
- typedef unsigned char __glibcpp_byte;
-#define __glibcpp_word_bits 32
-#if __CHAR_BIT__ == __glibcpp_word_bits
-# define __glibcpp_word unsigned char
-#elif __SHRT_BIT__ == __glibcpp_word_bits
-# define __glibcpp_word unsigned short
-#elif __INT_BIT__ == __glibcpp_word_bits
-# define __glibcpp_word unsigned int
-#elif __LONG_BIT__ == __glibcpp_word_bits
-# define __glibcpp_word unsigned long
-#endif
-
- // Define storage types for the single, double and extended floating
- // point data types. Maybe we could avoid the conditional #defines by
- // using the aligned_storage<> extension. -- Gaby
- typedef const
-#if __FLOAT_BIT__ % __glibcpp_word_bits == 0
- __glibcpp_word __float_storage[sizeof (float) / sizeof (__glibcpp_word)]
-#else
- __glibcpp_byte __float_storage[sizeof (float)]
-#endif
- __attribute__((__aligned__(__alignof__(float))));
-
- typedef const
-#if __DOUBLE_BIT__ % __glibcpp_word_bits == 0
- __glibcpp_word __double_storage[sizeof (double) / sizeof (__glibcpp_word)]
-#else
- __glibcpp_byte __double_storage[sizeof (double)]
-#endif
- __attribute__((__aligned__(__alignof__(double))));
-
- typedef const
-#if __LONG_DOUBLE_BIT__ % __glibcpp_word_bits == 0
- __glibcpp_word __long_double_storage[sizeof (long double) / sizeof (__glibcpp_word)]
-#else
- __glibcpp_byte __long_double_storage[sizeof (long double)]
-#endif
- __attribute__((__aligned__(__alignof__(long double))));
-
- enum float_round_style
+ /**
+ * @brief Describes the rounding style for floating-point types.
+ *
+ * This is used in the std::numeric_limits class.
+ */
+ enum float_round_style
{
- round_indeterminate = -1,
- round_toward_zero = 0,
- round_to_nearest = 1,
- round_toward_infinity = 2,
- round_toward_neg_infinity = 3
+ round_indeterminate = -1, ///< Self-explanatory.
+ round_toward_zero = 0, ///< Self-explanatory.
+ round_to_nearest = 1, ///< To the nearest representable value.
+ round_toward_infinity = 2, ///< Self-explanatory.
+ round_toward_neg_infinity = 3 ///< Self-explanatory.
};
- enum float_denorm_style
+ /**
+ * @brief Describes the denormalization for floating-point types.
+ *
+ * These values represent the presence or absence of a variable number
+ * of exponent bits. This type is used in the std::numeric_limits class.
+ */
+ enum float_denorm_style
{
+ /// Indeterminate at compile time whether denormalized values are allowed.
denorm_indeterminate = -1,
+ /// The type does not allow denormalized values.
denorm_absent = 0,
+ /// The type allows denormalized values.
denorm_present = 1
};
- //
- // The primary class traits
- //
+ /**
+ * @brief Part of std::numeric_limits.
+ *
+ * The @c static @c const members are usable as integral constant
+ * expressions.
+ *
+ * @note This is a seperate class for purposes of efficiency; you
+ * should only access these members as part of an instantiation
+ * of the std::numeric_limits class.
+ */
struct __numeric_limits_base
{
+ /** This will be true for all fundamental types (which have
+ specializations), and false for everything else. */
static const bool is_specialized = false;
+ /** The number of @c radix digits that be represented without change: for
+ integer types, the number of non-sign bits in the mantissa; for
+ floating types, the number of @c radix digits in the mantissa. */
static const int digits = 0;
+ /** The number of base 10 digits that can be represented without change. */
static const int digits10 = 0;
+ /** True if the type is signed. */
static const bool is_signed = false;
+ /** True if the type is integer.
+ * @if maint
+ * Is this supposed to be "if the type is integral"?
+ * @endif
+ */
static const bool is_integer = false;
+ /** True if the type uses an exact representation. "All integer types are
+ exact, but not all exact types are integer. For example, rational and
+ fixed-exponent representations are exact but not integer."
+ [18.2.1.2]/15 */
static const bool is_exact = false;
+ /** For integer types, specifies the base of the representation. For
+ floating types, specifies the base of the exponent representation. */
static const int radix = 0;
+ /** The minimum negative integer such that @c radix raised to the power of
+ (one less than that integer) is a normalized floating point number. */
static const int min_exponent = 0;
+ /** The minimum negative integer such that 10 raised to that power is in
+ the range of normalized floating point numbers. */
static const int min_exponent10 = 0;
+ /** The maximum positive integer such that @c radix raised to the power of
+ (one less than that integer) is a representable finite floating point
+ number. */
static const int max_exponent = 0;
+ /** The maximum positive integer such that 10 raised to that power is in
+ the range of representable finite floating point numbers. */
static const int max_exponent10 = 0;
-
+
+ /** True if the type has a representation for positive infinity. */
static const bool has_infinity = false;
+ /** True if the type has a representation for a quiet (non-signaling)
+ "Not a Number." */
static const bool has_quiet_NaN = false;
+ /** True if the type has a representation for a signaling
+ "Not a Number." */
static const bool has_signaling_NaN = false;
+ /** See std::float_denorm_style for more information. */
static const float_denorm_style has_denorm = denorm_absent;
+ /** "True if loss of accuracy is detected as a denormalization loss,
+ rather than as an inexact result." [18.2.1.2]/42 */
static const bool has_denorm_loss = false;
+ /** True if-and-only-if the type adheres to the IEC 559 standard, also
+ known as IEEE 754. (Only makes sense for floating point types.) */
static const bool is_iec559 = false;
+ /** "True if the set of values representable by the type is finite. All
+ built-in types are bounded, this member would be false for arbitrary
+ precision types." [18.2.1.2]/54 */
static const bool is_bounded = false;
+ /** True if the type is @e modulo, that is, if it is possible to add two
+ positive numbers and have a result that wraps around to a third number
+ that is less. Typically false for floating types, true for unsigned
+ integers, and true for signed integers. */
static const bool is_modulo = false;
+ /** True if trapping is implemented for this type. */
static const bool traps = false;
+ /** True if tinyness is detected before rounding. (see IEC 559) */
static const bool tinyness_before = false;
+ /** See std::float_round_style for more information. This is only
+ meaningful for floating types; integer types will all be
+ round_toward_zero. */
static const float_round_style round_style = round_toward_zero;
};
- template<typename _Tp>
- struct numeric_limits : public __numeric_limits_base
+ /**
+ * @brief Properties of fundamental types.
+ *
+ * This class allows a program to obtain information about the
+ * representation of a fundamental type on a given platform. For
+ * non-fundamental types, the functions will return 0 and the data
+ * members will all be @c false.
+ *
+ * @if maint
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are
+ * noted, but not incorporated in this documented (yet).
+ * @endif
+ */
+ template<typename _Tp>
+ struct numeric_limits : public __numeric_limits_base
{
+ /** The minimum finite value, or for floating types with
+ denormalization, the minimum positive normalized value. */
static _Tp min() throw() { return static_cast<_Tp>(0); }
+ /** The maximum finite value. */
static _Tp max() throw() { return static_cast<_Tp>(0); }
+ /** The @e machine @e epsilon: the difference between 1 and the least
+ value greater than 1 that is representable. */
static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
+ /** The maximum rounding error measurement (see LIA-1). */
static _Tp round_error() throw() { return static_cast<_Tp>(0); }
+ /** The representation of positive infinity, if @c has_infinity. */
static _Tp infinity() throw() { return static_cast<_Tp>(0); }
+ /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */
static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
+ /** The representation of a signaling "Not a Number," if
+ @c has_signaling_NaN. */
static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
+ /** The minimum positive denormalized value. For types where
+ @c has_denorm is false, this is the minimum positive normalized
+ value. */
static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
};
// Now there follow 15 explicit specializations. Yes, 15. Make sure
- // you get the count right.
+ // you get the count right.
+
+ /// numeric_limits<bool> specialization.
template<>
struct numeric_limits<bool>
{
static bool min() throw()
{ return false; }
-
static bool max() throw()
{ return true; }
- static const int digits = __glibcpp_bool_digits;
+ static const int digits = 1;
static const int digits10 = 0;
static const bool is_signed = false;
static const bool is_integer = true;
// It is not clear what it means for a boolean type to trap.
// This is a DR on the LWG issue list. Here, I use integer
// promotion semantics.
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_bool_digits
-
+ /// numeric_limits<char> specialization.
template<>
struct numeric_limits<char>
{
static const bool is_specialized = true;
static char min() throw()
- { return __glibcpp_char_min; }
+ { return __glibcxx_min(char); }
static char max() throw()
- { return __glibcpp_char_max; }
+ { return __glibcxx_max(char); }
- static const int digits = __glibcpp_char_digits;
- static const int digits10 = __glibcpp_char_digits10;
- static const bool is_signed = __glibcpp_plain_char_is_signed;
+ static const int digits = __glibcxx_digits (char);
+ static const int digits10 = __glibcxx_digits10 (char);
+ static const bool is_signed = __glibcxx_signed (char);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_char_min
-#undef __glibcpp_char_max
-#undef __glibcpp_char_digits
-#undef __glibcpp_char_digits10
-#undef __glibcpp_char_is_signed
-
-
-
+ /// numeric_limits<signed char> specialization.
template<>
struct numeric_limits<signed char>
{
static const bool is_specialized = true;
static signed char min() throw()
- { return __glibcpp_signed_char_min; }
+ { return -__SCHAR_MAX__ - 1; }
static signed char max() throw()
- { return __glibcpp_signed_char_max; }
+ { return __SCHAR_MAX__; }
- static const int digits = __glibcpp_signed_char_digits;
- static const int digits10 = __glibcpp_signed_char_digits10;
+ static const int digits = __glibcxx_digits (signed char);
+ static const int digits10 = __glibcxx_digits10 (signed char);
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_signed_char_min
-#undef __glibcpp_signed_char_max
-#undef __glibcpp_signed_char_digits
-#undef __glibcpp_signed_char_digits10
-
+ /// numeric_limits<unsigned char> specialization.
template<>
struct numeric_limits<unsigned char>
{
static unsigned char min() throw()
{ return 0; }
static unsigned char max() throw()
- { return __glibcpp_unsigned_char_max; }
+ { return __SCHAR_MAX__ * 2U + 1; }
- static const int digits = __glibcpp_unsigned_char_digits;
- static const int digits10 = __glibcpp_unsigned_char_digits10;
+ static const int digits = __glibcxx_digits (unsigned char);
+ static const int digits10 = __glibcxx_digits10 (unsigned char);
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_unsigned_char_max
-#undef __glibcpp_unsigned_char_digits
-#undef __glibcpp_unsigned_char_digits10
-
+ /// numeric_limits<wchar_t> specialization.
template<>
struct numeric_limits<wchar_t>
{
static const bool is_specialized = true;
static wchar_t min() throw()
- { return __glibcpp_wchar_t_min; }
+ { return __glibcxx_min (wchar_t); }
static wchar_t max() throw()
- { return __glibcpp_wchar_t_max; }
+ { return __glibcxx_max (wchar_t); }
- static const int digits = __glibcpp_wchar_t_digits;
- static const int digits10 = __glibcpp_wchar_t_digits10;
- static const bool is_signed = __glibcpp_wchar_t_is_signed;
+ static const int digits = __glibcxx_digits (wchar_t);
+ static const int digits10 = __glibcxx_digits10 (wchar_t);
+ static const bool is_signed = __glibcxx_signed (wchar_t);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_wchar_t_min
-#undef __glibcpp_wchar_t_max
-#undef __glibcpp_wchar_t_digits
-#undef __glibcpp_wchar_t_digits10
-#undef __glibcpp_wchar_t_is_signed
-
+ /// numeric_limits<short> specialization.
template<>
struct numeric_limits<short>
{
static const bool is_specialized = true;
static short min() throw()
- { return __glibcpp_signed_short_min; }
+ { return -__SHRT_MAX__ - 1; }
static short max() throw()
- { return __glibcpp_signed_short_max; }
+ { return __SHRT_MAX__; }
- static const int digits = __glibcpp_signed_short_digits;
- static const int digits10 = __glibcpp_signed_short_digits10;
+ static const int digits = __glibcxx_digits (short);
+ static const int digits10 = __glibcxx_digits10 (short);
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static short denorm_min() throw()
{ return short(); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_signed_short_min
-#undef __glibcpp_signed_short_max
-#undef __glibcpp_signed_short_digits
-#undef __glibcpp_signed_short_digits10
-
+ /// numeric_limits<unsigned short> specialization.
template<>
struct numeric_limits<unsigned short>
{
static unsigned short min() throw()
{ return 0; }
static unsigned short max() throw()
- { return __glibcpp_unsigned_short_max; }
+ { return __SHRT_MAX__ * 2U + 1; }
- static const int digits = __glibcpp_unsigned_short_digits;
- static const int digits10 = __glibcpp_unsigned_short_digits10;
+ static const int digits = __glibcxx_digits (unsigned short);
+ static const int digits10 = __glibcxx_digits10 (unsigned short);
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static unsigned short denorm_min() throw()
{ return static_cast<unsigned short>(0); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_unsigned_short_max
-#undef __glibcpp_unsigned_short_digits
-#undef __glibcpp_unsigned_short_digits10
-
+ /// numeric_limits<int> specialization.
template<>
struct numeric_limits<int>
{
static const bool is_specialized = true;
static int min() throw()
- { return __glibcpp_signed_int_min; }
+ { return -__INT_MAX__ - 1; }
static int max() throw()
- { return __glibcpp_signed_int_max; }
+ { return __INT_MAX__; }
- static const int digits = __glibcpp_signed_int_digits;
- static const int digits10 = __glibcpp_signed_int_digits10;
+ static const int digits = __glibcxx_digits (int);
+ static const int digits10 = __glibcxx_digits10 (int);
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static int denorm_min() throw()
{ return static_cast<int>(0); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_signed_int_min
-#undef __glibcpp_signed_int_max
-#undef __glibcpp_signed_int_digits
-#undef __glibcpp_signed_int_digits10
-
+ /// numeric_limits<unsigned int> specialization.
template<>
struct numeric_limits<unsigned int>
{
static unsigned int min() throw()
{ return 0; }
- static unsigned int max() throw()
- { return __glibcpp_unsigned_int_max; }
+ static unsigned int max() throw()
+ { return __INT_MAX__ * 2U + 1; }
- static const int digits = __glibcpp_unsigned_int_digits;
- static const int digits10 = __glibcpp_unsigned_int_digits10;
+ static const int digits = __glibcxx_digits (unsigned int);
+ static const int digits10 = __glibcxx_digits10 (unsigned int);
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static unsigned int denorm_min() throw()
{ return static_cast<unsigned int>(0); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_unsigned_int_max
-#undef __glibcpp_unsigned_int_digits
-#undef __glibcpp_unsigned_int_digits10
-
+ /// numeric_limits<long> specialization.
template<>
struct numeric_limits<long>
{
static const bool is_specialized = true;
static long min() throw()
- { return __glibcpp_signed_long_min; }
+ { return -__LONG_MAX__ - 1; }
static long max() throw()
- { return __glibcpp_signed_long_max; }
+ { return __LONG_MAX__; }
- static const int digits = __glibcpp_signed_long_digits;
- static const int digits10 = __glibcpp_signed_long_digits10;
+ static const int digits = __glibcxx_digits (long);
+ static const int digits10 = __glibcxx_digits10 (long);
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static long denorm_min() throw()
{ return static_cast<long>(0); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_signed_long_min
-#undef __glibcpp_signed_long_max
-#undef __glibcpp_signed_long_digits
-#undef __glibcpp_signed_long_digits10
-
+ /// numeric_limits<unsigned long> specialization.
template<>
struct numeric_limits<unsigned long>
{
static unsigned long min() throw()
{ return 0; }
static unsigned long max() throw()
- { return __glibcpp_unsigned_long_max; }
+ { return __LONG_MAX__ * 2UL + 1; }
- static const int digits = __glibcpp_unsigned_long_digits;
- static const int digits10 = __glibcpp_unsigned_long_digits10;
+ static const int digits = __glibcxx_digits (unsigned long);
+ static const int digits10 = __glibcxx_digits10 (unsigned long);
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static unsigned long denorm_min() throw()
{ return static_cast<unsigned long>(0); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_unsigned_long_max
-#undef __glibcpp_unsigned_long_digits
-#undef __glibcpp_unsigned_long_digits10
-
+ /// numeric_limits<long long> specialization.
template<>
struct numeric_limits<long long>
{
static const bool is_specialized = true;
-
+
static long long min() throw()
- { return __glibcpp_signed_long_long_min; }
+ { return -__LONG_LONG_MAX__ - 1; }
static long long max() throw()
- { return __glibcpp_signed_long_long_max; }
-
- static const int digits = __glibcpp_signed_long_long_digits;
- static const int digits10 = __glibcpp_signed_long_long_digits10;
+ { return __LONG_LONG_MAX__; }
+
+ static const int digits = __glibcxx_digits (long long);
+ static const int digits10 = __glibcxx_digits10 (long long);
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
{ return 0; }
static long long round_error() throw()
{ return 0; }
-
+
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
-
+
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
-
+
static long long infinity() throw()
{ return static_cast<long long>(0); }
static long long quiet_NaN() throw()
{ return static_cast<long long>(0); }
static long long denorm_min() throw()
{ return static_cast<long long>(0); }
-
- static const bool is_iec559 = true;
+
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_signed_long_long_min
-#undef __glibcpp_signed_long_long_max
-#undef __glibcpp_signed_long_long_digits
-#undef __glibcpp_signed_long_long_digits10
-
+ /// numeric_limits<unsigned long long> specialization.
template<>
struct numeric_limits<unsigned long long>
{
static unsigned long long min() throw()
{ return 0; }
static unsigned long long max() throw()
- { return __glibcpp_unsigned_long_long_max; }
+ { return __LONG_LONG_MAX__ * 2ULL + 1; }
- static const int digits = __glibcpp_unsigned_long_long_digits;
- static const int digits10 = __glibcpp_unsigned_long_long_digits10;
+ static const int digits = __glibcxx_digits (unsigned long long);
+ static const int digits10 = __glibcxx_digits10 (unsigned long long);
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static unsigned long long denorm_min() throw()
{ return static_cast<unsigned long long>(0); }
- static const bool is_iec559 = true;
+ static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
- static const bool traps = __glibcpp_integral_traps;
+ static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
-#undef __glibcpp_unsigned_long_long_max
-#undef __glibcpp_unsigned_long_long_digits
-#undef __glibcpp_unsigned_long_long_digits10
-
+ /// numeric_limits<float> specialization.
template<>
struct numeric_limits<float>
{
static const int max_exponent = __FLT_MAX_EXP__;
static const int max_exponent10 = __FLT_MAX_10_EXP__;
- static const bool has_infinity
- = __builtin_huge_valf () / 2 == __builtin_huge_valf ();
- static const bool has_quiet_NaN
- = __builtin_nanf ("") != __builtin_nanf ("");
+ static const bool has_infinity = __FLT_HAS_INFINITY__;
+ static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
static const bool has_signaling_NaN = has_quiet_NaN;
static const float_denorm_style has_denorm
- = __FLT_DENORM_MIN__ ? denorm_present : denorm_absent;
- static const bool has_denorm_loss = __glibcpp_float_has_denorm_loss;
+ = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
+ static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
static float infinity() throw()
{ return __builtin_huge_valf (); }
static float denorm_min() throw()
{ return __FLT_DENORM_MIN__; }
- static const bool is_iec559 = has_infinity && has_quiet_NaN;
+ static const bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static const bool is_bounded = true;
- static const bool is_modulo = __glibcpp_float_is_modulo;
+ static const bool is_modulo = false;
- static const bool traps = __glibcpp_float_traps;
- static const bool tinyness_before = __glibcpp_float_tinyness_before;
+ static const bool traps = __glibcxx_float_traps;
+ static const bool tinyness_before = __glibcxx_float_tinyness_before;
static const float_round_style round_style = round_to_nearest;
};
-#undef __glibcpp_float_has_denorm_loss
-#undef __glibcpp_float_is_modulo
-#undef __glibcpp_float_traps
-#undef __glibcpp_float_tinyness_before
+#undef __glibcxx_float_has_denorm_loss
+#undef __glibcxx_float_traps
+#undef __glibcxx_float_tinyness_before
+ /// numeric_limits<double> specialization.
template<>
struct numeric_limits<double>
{
static const int max_exponent = __DBL_MAX_EXP__;
static const int max_exponent10 = __DBL_MAX_10_EXP__;
- static const bool has_infinity
- = __builtin_huge_val () / 2 == __builtin_huge_val ();
- static const bool has_quiet_NaN
- = __builtin_nan ("") != __builtin_nan ("");
+ static const bool has_infinity = __DBL_HAS_INFINITY__;
+ static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
static const bool has_signaling_NaN = has_quiet_NaN;
static const float_denorm_style has_denorm
- = __DBL_DENORM_MIN__ ? denorm_present : denorm_absent;
- static const bool has_denorm_loss = __glibcpp_double_has_denorm_loss;
+ = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
+ static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
static double infinity() throw()
{ return __builtin_huge_val(); }
static double denorm_min() throw()
{ return __DBL_DENORM_MIN__; }
- static const bool is_iec559 = has_infinity && has_quiet_NaN;
+ static const bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static const bool is_bounded = true;
- static const bool is_modulo = __glibcpp_double_is_modulo;
+ static const bool is_modulo = false;
- static const bool traps = __glibcpp_double_traps;
- static const bool tinyness_before = __glibcpp_double_tinyness_before;
+ static const bool traps = __glibcxx_double_traps;
+ static const bool tinyness_before = __glibcxx_double_tinyness_before;
static const float_round_style round_style = round_to_nearest;
};
-#undef __glibcpp_double_has_denorm_loss
-#undef __glibcpp_double_is_modulo
-#undef __glibcpp_double_traps
-#undef __glibcpp_double_tinyness_before
-
-
+#undef __glibcxx_double_has_denorm_loss
+#undef __glibcxx_double_traps
+#undef __glibcxx_double_tinyness_before
+
+ /// numeric_limits<long double> specialization.
template<>
struct numeric_limits<long double>
{
static const int max_exponent = __LDBL_MAX_EXP__;
static const int max_exponent10 = __LDBL_MAX_10_EXP__;
- static const bool has_infinity
- = __builtin_huge_vall () / 2 == __builtin_huge_vall ();
- static const bool has_quiet_NaN
- = __builtin_nanl ("") != __builtin_nanl ("");
+ static const bool has_infinity = __LDBL_HAS_INFINITY__;
+ static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
static const bool has_signaling_NaN = has_quiet_NaN;
static const float_denorm_style has_denorm
- = __LDBL_DENORM_MIN__ ? denorm_present : denorm_absent;
+ = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
static const bool has_denorm_loss
- = __glibcpp_long_double_has_denorm_loss;
+ = __glibcxx_long_double_has_denorm_loss;
static long double infinity() throw()
- { return __builtin_huge_vall (); }
+ { return __builtin_huge_vall (); }
static long double quiet_NaN() throw()
{ return __builtin_nanl (""); }
static long double signaling_NaN() throw()
static long double denorm_min() throw()
{ return __LDBL_DENORM_MIN__; }
- static const bool is_iec559 = has_infinity && has_quiet_NaN;
+ static const bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static const bool is_bounded = true;
- static const bool is_modulo = __glibcpp_long_double_is_modulo;
+ static const bool is_modulo = false;
- static const bool traps = __glibcpp_long_double_traps;
- static const bool tinyness_before = __glibcpp_long_double_tinyness_before;
+ static const bool traps = __glibcxx_long_double_traps;
+ static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
static const float_round_style round_style = round_to_nearest;
};
-#undef __glibcpp_long_double_has_denorm_loss
-#undef __glibcpp_long_double_is_modulo
-#undef __glibcpp_long_double_traps
-#undef __glibcpp_long_double_tinyness_before
+#undef __glibcxx_long_double_has_denorm_loss
+#undef __glibcxx_long_double_traps
+#undef __glibcxx_long_double_tinyness_before
} // namespace std
-#endif // _CPP_NUMERIC_LIMITS
+#undef __glibcxx_signed
+#undef __glibcxx_min
+#undef __glibcxx_max
+#undef __glibcxx_digits
+#undef __glibcxx_digits10
+
+#endif // _GLIBCXX_NUMERIC_LIMITS