[cfe-commits] [libcxx] r131318 - in /libcxx/trunk: include/ test/ test/depr/depr.c.headers/ test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/ test/numerics/c.math/
Howard Hinnant
hhinnant at apple.com
Fri May 13 14:52:40 PDT 2011
Author: hhinnant
Date: Fri May 13 16:52:40 2011
New Revision: 131318
URL: http://llvm.org/viewvc/llvm-project?rev=131318&view=rev
Log:
http://llvm.org/bugs/show_bug.cgi?id=9854. Also created an emulated hexfloat literal for use in some of the tests. <sigh> And cleaned up some harmless but irritating warnings in the tests.
Added:
libcxx/trunk/test/hexfloat.h
Modified:
libcxx/trunk/include/cmath
libcxx/trunk/include/iosfwd
libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp
libcxx/trunk/test/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
libcxx/trunk/test/numerics/c.math/cmath.pass.cpp
Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Fri May 13 16:52:40 2011
@@ -303,673 +303,663 @@
#pragma GCC system_header
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-using ::float_t;
-using ::double_t;
+// signbit
-// abs
+#ifdef signbit
template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, _A1>::type
-abs(_A1 __x) {return fabs(__x);}
-
-// acos
-
-using ::acos;
-using ::acosf;
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_signbit(_A1 __x)
+{
+ return signbit(__x);
+}
-inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);}
+#undef signbit
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-acos(_A1 __x) {return acos((double)__x);}
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+signbit(_A1 __x)
+{
+ return __libcpp_signbit(__x);
+}
-// asin
+#endif // signbit
-using ::asin;
-using ::asinf;
+// fpclassify
-inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);}
+#ifdef fpclassify
template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-asin(_A1 __x) {return asin((double)__x);}
-
-// atan
-
-using ::atan;
-using ::atanf;
+_LIBCPP_ALWAYS_INLINE
+int
+__libcpp_fpclassify(_A1 __x)
+{
+ return fpclassify(__x);
+}
-inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);}
+#undef fpclassify
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-atan(_A1 __x) {return atan((double)__x);}
+typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
+fpclassify(_A1 __x)
+{
+ return __libcpp_fpclassify(__x);
+}
-// atan2
+#endif // fpclassify
-using ::atan2;
-using ::atan2f;
+// isfinite
-inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) {return atan2f(__y, __x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) {return atan2l(__y, __x);}
+#ifdef isfinite
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- typename __promote<_A1, _A2>::type
->::type
-atan2(_A1 __y, _A2 __x)
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isfinite(_A1 __x)
{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return atan2((__result_type)__y, (__result_type)__x);
+ return isfinite(__x);
}
-// ceil
-
-using ::ceil;
-using ::ceilf;
-
-inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);}
+#undef isfinite
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-ceil(_A1 __x) {return ceil((double)__x);}
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+isfinite(_A1 __x)
+{
+ return __libcpp_isfinite(__x);
+}
-// cos
+#endif // isfinite
-using ::cos;
-using ::cosf;
+// isinf
-inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);}
+#ifdef isinf
template <class _A1>
-inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-cos(_A1 __x) {return cos((double)__x);}
-
-// cosh
-
-using ::cosh;
-using ::coshf;
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isinf(_A1 __x)
+{
+ return isinf(__x);
+}
-inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);}
+#undef isinf
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-cosh(_A1 __x) {return cosh((double)__x);}
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+isinf(_A1 __x)
+{
+ return __libcpp_isinf(__x);
+}
-// exp
+#endif // isinf
-using ::exp;
-using ::expf;
+// isnan
-inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);}
+#ifdef isnan
template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-exp(_A1 __x) {return exp((double)__x);}
-
-// fabs
-
-using ::fabs;
-using ::fabsf;
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isnan(_A1 __x)
+{
+ return isnan(__x);
+}
-inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);}
+#undef isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-fabs(_A1 __x) {return fabs((double)__x);}
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+isnan(_A1 __x)
+{
+ return __libcpp_isnan(__x);
+}
-// floor
+#endif // isnan
-using ::floor;
-using ::floorf;
+// isnormal
-inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floorf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);}
+#ifdef isnormal
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isnormal(_A1 __x)
+{
+ return isnormal(__x);
+}
+
+#undef isnormal
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-floor(_A1 __x) {return floor((double)__x);}
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+isnormal(_A1 __x)
+{
+ return __libcpp_isnormal(__x);
+}
-// fmod
+#endif // isnormal
-using ::fmod;
-using ::fmodf;
+// isgreater
-inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) {return fmodf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) {return fmodl(__x, __y);}
+#ifdef isgreater
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isgreater(_A1 __x, _A2 __y)
+{
+ return isgreater(__x, __y);
+}
+
+#undef isgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename std::enable_if
<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- typename __promote<_A1, _A2>::type
+ std::is_floating_point<_A1>::value &&
+ std::is_floating_point<_A2>::value,
+ bool
>::type
-fmod(_A1 __x, _A2 __y)
+isgreater(_A1 __x, _A2 __y)
{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return fmod((__result_type)__x, (__result_type)__y);
+ return __libcpp_isgreater(__x, __y);
}
-// frexp
-
-using ::frexp;
-using ::frexpf;
-
-inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) {return frexpf(__x, __e);}
-inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) {return frexpl(__x, __e);}
+#endif // isgreater
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-frexp(_A1 __x, int* __e) {return frexp((double)__x, __e);}
+// isgreaterequal
-// ldexp
+#ifdef isgreaterequal
-using ::ldexp;
-using ::ldexpf;
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isgreaterequal(_A1 __x, _A2 __y)
+{
+ return isgreaterequal(__x, __y);
+}
-inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) {return ldexpf(__x, __e);}
-inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) {return ldexpl(__x, __e);}
+#undef isgreaterequal
-template <class _A1>
+template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);}
+typename std::enable_if
+<
+ std::is_floating_point<_A1>::value &&
+ std::is_floating_point<_A2>::value,
+ bool
+>::type
+isgreaterequal(_A1 __x, _A2 __y)
+{
+ return __libcpp_isgreaterequal(__x, __y);
+}
-// log
+#endif // isgreaterequal
-using ::log;
-using ::logf;
+// isless
-inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);}
+#ifdef isless
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-log(_A1 __x) {return log((double)__x);}
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isless(_A1 __x, _A2 __y)
+{
+ return isless(__x, __y);
+}
-// log10
+#undef isless
-using ::log10;
-using ::log10f;
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_floating_point<_A1>::value &&
+ std::is_floating_point<_A2>::value,
+ bool
+>::type
+isless(_A1 __x, _A2 __y)
+{
+ return __libcpp_isless(__x, __y);
+}
-inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log10f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);}
+#endif // isless
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-log10(_A1 __x) {return log10((double)__x);}
+// islessequal
-// modf
+#ifdef islessequal
-using ::modf;
-using ::modff;
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_islessequal(_A1 __x, _A2 __y)
+{
+ return islessequal(__x, __y);
+}
-inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) {return modff(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) {return modfl(__x, __y);}
+#undef islessequal
-// pow
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_floating_point<_A1>::value &&
+ std::is_floating_point<_A2>::value,
+ bool
+>::type
+islessequal(_A1 __x, _A2 __y)
+{
+ return __libcpp_islessequal(__x, __y);
+}
-using ::pow;
-using ::powf;
+#endif // islessequal
-inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) {return powf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);}
+// islessgreater
+
+#ifdef islessgreater
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_islessgreater(_A1 __x, _A2 __y)
+{
+ return islessgreater(__x, __y);
+}
+
+#undef islessgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename std::enable_if
<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- typename __promote<_A1, _A2>::type
+ std::is_floating_point<_A1>::value &&
+ std::is_floating_point<_A2>::value,
+ bool
>::type
-pow(_A1 __x, _A2 __y)
+islessgreater(_A1 __x, _A2 __y)
{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return pow((__result_type)__x, (__result_type)__y);
+ return __libcpp_islessgreater(__x, __y);
}
-// sin
+#endif // islessgreater
-using ::sin;
-using ::sinf;
+// isunordered
-inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);}
+#ifdef isunordered
-template <class _A1>
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isunordered(_A1 __x, _A2 __y)
+{
+ return isunordered(__x, __y);
+}
+
+#undef isunordered
+
+template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-sin(_A1 __x) {return sin((double)__x);}
+typename std::enable_if
+<
+ std::is_floating_point<_A1>::value &&
+ std::is_floating_point<_A2>::value,
+ bool
+>::type
+isunordered(_A1 __x, _A2 __y)
+{
+ return __libcpp_isunordered(__x, __y);
+}
-// sinh
+#endif // isunordered
-using ::sinh;
-using ::sinhf;
+_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);}
+using ::signbit;
+using ::fpclassify;
+using ::isfinite;
+using ::isinf;
+using ::isnan;
+using ::isnormal;
+using ::isgreater;
+using ::isgreaterequal;
+using ::isless;
+using ::islessequal;
+using ::islessgreater;
+using ::isunordered;
+using ::isunordered;
+
+using ::float_t;
+using ::double_t;
+
+// abs
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_integral<_A1>::value, double>::type
-sinh(_A1 __x) {return sinh((double)__x);}
+typename enable_if<is_floating_point<_A1>::value, _A1>::type
+abs(_A1 __x) {return fabs(__x);}
-// sqrt
+// acos
-using ::sqrt;
-using ::sqrtf;
+using ::acos;
+using ::acosf;
-inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-sqrt(_A1 __x) {return sqrt((double)__x);}
+acos(_A1 __x) {return acos((double)__x);}
-// tan
+// asin
-using ::tan;
-using ::tanf;
+using ::asin;
+using ::asinf;
-inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-tan(_A1 __x) {return tan((double)__x);}
+asin(_A1 __x) {return asin((double)__x);}
-// tanh
+// atan
-using ::tanh;
-using ::tanhf;
+using ::atan;
+using ::atanf;
-inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-tanh(_A1 __x) {return tanh((double)__x);}
-
-// signbit
+atan(_A1 __x) {return atan((double)__x);}
-#ifndef signbit
-#error Implementation error: signbit not defined
-#else
+// atan2
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_signbit(_A1 __x)
-{
- return signbit(__x);
-}
+using ::atan2;
+using ::atan2f;
-#undef signbit
+inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) {return atan2f(__y, __x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) {return atan2l(__y, __x);}
-template <class _A1>
+template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, bool>::type
-signbit(_A1 __x)
+typename enable_if
+<
+ is_arithmetic<_A1>::value &&
+ is_arithmetic<_A2>::value,
+ typename __promote<_A1, _A2>::type
+>::type
+atan2(_A1 __y, _A2 __x)
{
- return __libcpp_signbit(__x);
+ typedef typename __promote<_A1, _A2>::type __result_type;
+ static_assert((!(is_same<_A1, __result_type>::value &&
+ is_same<_A2, __result_type>::value)), "");
+ return atan2((__result_type)__y, (__result_type)__x);
}
-#endif // signbit
-
-// fpclassify
-
-#ifndef fpclassify
-#error Implementation error: fpclassify not defined
-#else
+// ceil
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-int
-__libcpp_fpclassify(_A1 __x)
-{
- return fpclassify(__x);
-}
+using ::ceil;
+using ::ceilf;
-#undef fpclassify
+inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, int>::type
-fpclassify(_A1 __x)
-{
- return __libcpp_fpclassify(__x);
-}
+typename enable_if<is_integral<_A1>::value, double>::type
+ceil(_A1 __x) {return ceil((double)__x);}
-#endif // fpclassify
+// cos
-// isfinite
+using ::cos;
+using ::cosf;
-#ifndef isfinite
-#error Implementation error: isfinite not defined
-#else
+inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);}
template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isfinite(_A1 __x)
-{
- return isfinite(__x);
-}
+inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+cos(_A1 __x) {return cos((double)__x);}
-#undef isfinite
+// cosh
+
+using ::cosh;
+using ::coshf;
+
+inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, bool>::type
-isfinite(_A1 __x)
-{
- return __libcpp_isfinite(__x);
-}
+typename enable_if<is_integral<_A1>::value, double>::type
+cosh(_A1 __x) {return cosh((double)__x);}
-#endif // isfinite
+// exp
-// isinf
+using ::exp;
+using ::expf;
-#ifndef isinf
-#error Implementation error: isinf not defined
-#else
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isinf(_A1 __x)
-{
- return isinf(__x);
-}
-
-#undef isinf
+inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, bool>::type
-isinf(_A1 __x)
-{
- return __libcpp_isinf(__x);
-}
-
-#endif // isinf
-
-// isnan
+typename enable_if<is_integral<_A1>::value, double>::type
+exp(_A1 __x) {return exp((double)__x);}
-#ifndef isnan
-#error Implementation error: isnan not defined
-#else
+// fabs
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isnan(_A1 __x)
-{
- return isnan(__x);
-}
+using ::fabs;
+using ::fabsf;
-#undef isnan
+inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, bool>::type
-isnan(_A1 __x)
-{
- return __libcpp_isnan(__x);
-}
-
-#endif // isnan
-
-// isnormal
+typename enable_if<is_integral<_A1>::value, double>::type
+fabs(_A1 __x) {return fabs((double)__x);}
-#ifndef isnormal
-#error Implementation error: isnormal not defined
-#else
+// floor
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isnormal(_A1 __x)
-{
- return isnormal(__x);
-}
+using ::floor;
+using ::floorf;
-#undef isnormal
+inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floorf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, bool>::type
-isnormal(_A1 __x)
-{
- return __libcpp_isnormal(__x);
-}
-
-#endif // isnormal
-
-// isgreater
+typename enable_if<is_integral<_A1>::value, double>::type
+floor(_A1 __x) {return floor((double)__x);}
-#ifndef isgreater
-#error Implementation error: isgreater not defined
-#else
+// fmod
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isgreater(_A1 __x, _A2 __y)
-{
- return isgreater(__x, __y);
-}
+using ::fmod;
+using ::fmodf;
-#undef isgreater
+inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) {return fmodf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) {return fmodl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_floating_point<_A1>::value &&
- is_floating_point<_A2>::value,
- bool
+ is_arithmetic<_A1>::value &&
+ is_arithmetic<_A2>::value,
+ typename __promote<_A1, _A2>::type
>::type
-isgreater(_A1 __x, _A2 __y)
+fmod(_A1 __x, _A2 __y)
{
- return __libcpp_isgreater(__x, __y);
+ typedef typename __promote<_A1, _A2>::type __result_type;
+ static_assert((!(is_same<_A1, __result_type>::value &&
+ is_same<_A2, __result_type>::value)), "");
+ return fmod((__result_type)__x, (__result_type)__y);
}
-#endif // isgreater
+// frexp
-// isgreaterequal
+using ::frexp;
+using ::frexpf;
-#ifndef isgreaterequal
-#error Implementation error: isgreaterequal not defined
-#else
+inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) {return frexpf(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) {return frexpl(__x, __e);}
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isgreaterequal(_A1 __x, _A2 __y)
-{
- return isgreaterequal(__x, __y);
-}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+frexp(_A1 __x, int* __e) {return frexp((double)__x, __e);}
-#undef isgreaterequal
+// ldexp
-template <class _A1, class _A2>
+using ::ldexp;
+using ::ldexpf;
+
+inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) {return ldexpf(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) {return ldexpl(__x, __e);}
+
+template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_floating_point<_A1>::value &&
- is_floating_point<_A2>::value,
- bool
->::type
-isgreaterequal(_A1 __x, _A2 __y)
-{
- return __libcpp_isgreaterequal(__x, __y);
-}
+typename enable_if<is_integral<_A1>::value, double>::type
+ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);}
-#endif // isgreaterequal
+// log
-// isless
+using ::log;
+using ::logf;
-#ifndef isless
-#error Implementation error: isless not defined
-#else
+inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);}
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isless(_A1 __x, _A2 __y)
-{
- return isless(__x, __y);
-}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+log(_A1 __x) {return log((double)__x);}
-#undef isless
+// log10
-template <class _A1, class _A2>
+using ::log10;
+using ::log10f;
+
+inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log10f(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);}
+
+template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_floating_point<_A1>::value &&
- is_floating_point<_A2>::value,
- bool
->::type
-isless(_A1 __x, _A2 __y)
-{
- return __libcpp_isless(__x, __y);
-}
+typename enable_if<is_integral<_A1>::value, double>::type
+log10(_A1 __x) {return log10((double)__x);}
-#endif // isless
+// modf
-// islessequal
+using ::modf;
+using ::modff;
-#ifndef islessequal
-#error Implementation error: islessequal not defined
-#else
+inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) {return modff(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) {return modfl(__x, __y);}
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_islessequal(_A1 __x, _A2 __y)
-{
- return islessequal(__x, __y);
-}
+// pow
-#undef islessequal
+using ::pow;
+using ::powf;
+
+inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) {return powf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_floating_point<_A1>::value &&
- is_floating_point<_A2>::value,
- bool
+ is_arithmetic<_A1>::value &&
+ is_arithmetic<_A2>::value,
+ typename __promote<_A1, _A2>::type
>::type
-islessequal(_A1 __x, _A2 __y)
+pow(_A1 __x, _A2 __y)
{
- return __libcpp_islessequal(__x, __y);
+ typedef typename __promote<_A1, _A2>::type __result_type;
+ static_assert((!(is_same<_A1, __result_type>::value &&
+ is_same<_A2, __result_type>::value)), "");
+ return pow((__result_type)__x, (__result_type)__y);
}
-#endif // islessequal
+// sin
-// islessgreater
+using ::sin;
+using ::sinf;
-#ifndef islessgreater
-#error Implementation error: islessgreater not defined
-#else
+inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);}
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_islessgreater(_A1 __x, _A2 __y)
-{
- return islessgreater(__x, __y);
-}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+sin(_A1 __x) {return sin((double)__x);}
-#undef islessgreater
+// sinh
-template <class _A1, class _A2>
+using ::sinh;
+using ::sinhf;
+
+inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);}
+
+template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_floating_point<_A1>::value &&
- is_floating_point<_A2>::value,
- bool
->::type
-islessgreater(_A1 __x, _A2 __y)
-{
- return __libcpp_islessgreater(__x, __y);
-}
+typename enable_if<is_integral<_A1>::value, double>::type
+sinh(_A1 __x) {return sinh((double)__x);}
-#endif // islessgreater
+// sqrt
-// isunordered
+using ::sqrt;
+using ::sqrtf;
-#ifndef isunordered
-#error Implementation error: isunordered not defined
-#else
+inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);}
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isunordered(_A1 __x, _A2 __y)
-{
- return isunordered(__x, __y);
-}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+sqrt(_A1 __x) {return sqrt((double)__x);}
-#undef isunordered
+// tan
-template <class _A1, class _A2>
+using ::tan;
+using ::tanf;
+
+inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);}
+
+template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_floating_point<_A1>::value &&
- is_floating_point<_A2>::value,
- bool
->::type
-isunordered(_A1 __x, _A2 __y)
-{
- return __libcpp_isunordered(__x, __y);
-}
+typename enable_if<is_integral<_A1>::value, double>::type
+tan(_A1 __x) {return tan((double)__x);}
-#endif // isunordered
+// tanh
+
+using ::tanh;
+using ::tanhf;
+
+inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if<is_integral<_A1>::value, double>::type
+tanh(_A1 __x) {return tanh((double)__x);}
// acosh
Modified: libcxx/trunk/include/iosfwd
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iosfwd?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/include/iosfwd (original)
+++ libcxx/trunk/include/iosfwd Fri May 13 16:52:40 2011
@@ -20,6 +20,7 @@
template<class charT> struct char_traits;
template<class T> class allocator;
+class ios_base;
template <class charT, class traits = char_traits<charT> > class basic_ios;
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
Modified: libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp (original)
+++ libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp Fri May 13 16:52:40 2011
@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
+#include "../../hexfloat.h"
+
void test_acos()
{
static_assert((std::is_same<decltype(acos((double)0)), double>::value), "");
@@ -194,9 +196,9 @@
void test_signbit()
{
- static_assert((std::is_same<decltype(signbit((float)0)), int>::value), "");
- static_assert((std::is_same<decltype(signbit((double)0)), int>::value), "");
- static_assert((std::is_same<decltype(signbit((long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(signbit((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(signbit((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(signbit((long double)0)), bool>::value), "");
assert(signbit(-1.0) == true);
}
@@ -210,117 +212,117 @@
void test_isfinite()
{
- static_assert((std::is_same<decltype(isfinite((float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isfinite((double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isfinite((long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isfinite((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isfinite((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isfinite((long double)0)), bool>::value), "");
assert(isfinite(-1.0) == true);
}
void test_isinf()
{
- static_assert((std::is_same<decltype(isinf((float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isinf((double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isinf((long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
assert(isinf(-1.0) == false);
}
void test_isnan()
{
- static_assert((std::is_same<decltype(isnan((float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isnan((double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isnan((long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
assert(isnan(-1.0) == false);
}
void test_isnormal()
{
- static_assert((std::is_same<decltype(isnormal((float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isnormal((double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isnormal((long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isnormal((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnormal((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnormal((long double)0)), bool>::value), "");
assert(isnormal(-1.0) == true);
}
void test_isgreater()
{
- static_assert((std::is_same<decltype(isgreater((float)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((float)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((float)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((double)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((long double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((long double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreater((long double)0, (long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isgreater((float)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((float)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((float)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((long double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((long double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater((long double)0, (long double)0)), bool>::value), "");
assert(isgreater(-1.0, 0.F) == false);
}
void test_isgreaterequal()
{
- static_assert((std::is_same<decltype(isgreaterequal((float)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((float)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((float)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((double)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((long double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((long double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isgreaterequal((long double)0, (long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((float)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((float)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((float)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((long double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((long double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal((long double)0, (long double)0)), bool>::value), "");
assert(isgreaterequal(-1.0, 0.F) == false);
}
void test_isless()
{
- static_assert((std::is_same<decltype(isless((float)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((float)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((float)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((double)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((long double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((long double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isless((long double)0, (long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isless((float)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((float)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((float)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((long double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((long double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless((long double)0, (long double)0)), bool>::value), "");
assert(isless(-1.0, 0.F) == true);
}
void test_islessequal()
{
- static_assert((std::is_same<decltype(islessequal((float)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((float)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((float)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((double)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((long double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((long double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessequal((long double)0, (long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(islessequal((float)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((float)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((float)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((long double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((long double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal((long double)0, (long double)0)), bool>::value), "");
assert(islessequal(-1.0, 0.F) == true);
}
void test_islessgreater()
{
- static_assert((std::is_same<decltype(islessgreater((float)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((float)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((float)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((double)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((long double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((long double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(islessgreater((long double)0, (long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((float)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((float)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((float)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((long double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((long double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater((long double)0, (long double)0)), bool>::value), "");
assert(islessgreater(-1.0, 0.F) == true);
}
void test_isunordered()
{
- static_assert((std::is_same<decltype(isunordered((float)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((float)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((float)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((double)0, (long double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((long double)0, (float)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((long double)0, (double)0)), int>::value), "");
- static_assert((std::is_same<decltype(isunordered((long double)0, (long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(isunordered((float)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((float)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((float)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((long double)0, (float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((long double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered((long double)0, (long double)0)), bool>::value), "");
assert(isunordered(-1.0, 0.F) == false);
}
@@ -528,7 +530,7 @@
static_assert((std::is_same<decltype(nextafter((double)0, (double)0)), double>::value), "");
static_assert((std::is_same<decltype(nextafterf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(nextafterl(0,0)), long double>::value), "");
- assert(nextafter(0,1) == 0x1p-1074);
+ assert(nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
}
void test_nexttoward()
@@ -536,7 +538,7 @@
static_assert((std::is_same<decltype(nexttoward((double)0, (long double)0)), double>::value), "");
static_assert((std::is_same<decltype(nexttowardf(0, (long double)0)), float>::value), "");
static_assert((std::is_same<decltype(nexttowardl(0, (long double)0)), long double>::value), "");
- assert(nexttoward(0, 1) == 0x1p-1074);
+ assert(nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
}
void test_remainder()
Modified: libcxx/trunk/test/depr/depr.c.headers/stdio_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/depr/depr.c.headers/stdio_h.pass.cpp?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/test/depr/depr.c.headers/stdio_h.pass.cpp (original)
+++ libcxx/trunk/test/depr/depr.c.headers/stdio_h.pass.cpp Fri May 13 16:52:40 2011
@@ -95,19 +95,19 @@
static_assert((std::is_same<decltype(freopen("", "", fp)), FILE*>::value), "");
static_assert((std::is_same<decltype(setbuf(fp,cp)), void>::value), "");
static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
- static_assert((std::is_same<decltype(fprintf(fp,"")), int>::value), "");
+ static_assert((std::is_same<decltype(fprintf(fp," ")), int>::value), "");
static_assert((std::is_same<decltype(fscanf(fp,"")), int>::value), "");
- static_assert((std::is_same<decltype(printf("")), int>::value), "");
- static_assert((std::is_same<decltype(scanf("")), int>::value), "");
- static_assert((std::is_same<decltype(snprintf(cp,0,"")), int>::value), "");
- static_assert((std::is_same<decltype(sprintf(cp,"")), int>::value), "");
+ static_assert((std::is_same<decltype(printf("\n")), int>::value), "");
+ static_assert((std::is_same<decltype(scanf("\n")), int>::value), "");
+ static_assert((std::is_same<decltype(snprintf(cp,0,"p")), int>::value), "");
+ static_assert((std::is_same<decltype(sprintf(cp," ")), int>::value), "");
static_assert((std::is_same<decltype(sscanf("","")), int>::value), "");
static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vfscanf(fp,"",va)), int>::value), "");
- static_assert((std::is_same<decltype(vprintf("",va)), int>::value), "");
+ static_assert((std::is_same<decltype(vprintf(" ",va)), int>::value), "");
static_assert((std::is_same<decltype(vscanf("",va)), int>::value), "");
- static_assert((std::is_same<decltype(vsnprintf(cp,0,"",va)), int>::value), "");
- static_assert((std::is_same<decltype(vsprintf(cp,"",va)), int>::value), "");
+ static_assert((std::is_same<decltype(vsnprintf(cp,0," ",va)), int>::value), "");
+ static_assert((std::is_same<decltype(vsprintf(cp," ",va)), int>::value), "");
static_assert((std::is_same<decltype(vsscanf("","",va)), int>::value), "");
static_assert((std::is_same<decltype(fgetc(fp)), int>::value), "");
static_assert((std::is_same<decltype(fgets(cp,0,fp)), char*>::value), "");
Added: libcxx/trunk/test/hexfloat.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/hexfloat.h?rev=131318&view=auto
==============================================================================
--- libcxx/trunk/test/hexfloat.h (added)
+++ libcxx/trunk/test/hexfloat.h Fri May 13 16:52:40 2011
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Define a hexfloat literal emulator since we can't depend on being able to
+// for hexfloat literals
+
+// 0x10.F5p-10 == hexfloat<double>(0x10, 0xF5, -10)
+
+#ifndef HEXFLOAT_H
+#define HEXFLOAT_H
+
+#include <algorithm>
+#include <cmath>
+#include <climits>
+
+template <class T>
+class hexfloat
+{
+ T value_;
+public:
+ hexfloat(unsigned long long m1, unsigned long long m0, int exp)
+ {
+ const std::size_t n = sizeof(unsigned long long) * CHAR_BIT;
+ value_ = std::ldexp(m1 + std::ldexp(T(m0), -static_cast<int>(n -
+ std::__clz(m0))), exp);
+ }
+
+ operator T() const {return value_;}
+};
+
+#endif
Modified: libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp (original)
+++ libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp Fri May 13 16:52:40 2011
@@ -20,6 +20,7 @@
#include <streambuf>
#include <cmath>
#include "iterators.h"
+#include "../../../../../hexfloat.h"
typedef std::num_get<char, input_iterator<const char*> > F;
@@ -105,7 +106,7 @@
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
- assert(v == 0x125p-1);
+ assert(v == hexfloat<double>(0x125, 0, -1));
}
{
const char str[] = "inf";
Modified: libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp (original)
+++ libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp Fri May 13 16:52:40 2011
@@ -20,6 +20,7 @@
#include <streambuf>
#include <cmath>
#include "iterators.h"
+#include "../../../../../hexfloat.h"
typedef std::num_get<char, input_iterator<const char*> > F;
@@ -93,7 +94,7 @@
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
- assert(v == 0x125p-1);
+ assert(v == hexfloat<float>(0x125, 0, -1));
}
{
const char str[] = "inf";
Modified: libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp (original)
+++ libcxx/trunk/test/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp Fri May 13 16:52:40 2011
@@ -20,6 +20,7 @@
#include <streambuf>
#include <cmath>
#include "iterators.h"
+#include "../../../../../hexfloat.h"
typedef std::num_get<char, input_iterator<const char*> > F;
@@ -93,7 +94,7 @@
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
- assert(v == 0x125p-1);
+ assert(v == hexfloat<long double>(0x125, 0, -1));
}
{
const char str[] = "inf";
Modified: libcxx/trunk/test/numerics/c.math/cmath.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/numerics/c.math/cmath.pass.cpp?rev=131318&r1=131317&r2=131318&view=diff
==============================================================================
--- libcxx/trunk/test/numerics/c.math/cmath.pass.cpp (original)
+++ libcxx/trunk/test/numerics/c.math/cmath.pass.cpp Fri May 13 16:52:40 2011
@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
+#include "../../hexfloat.h"
+
void test_abs()
{
static_assert((std::is_same<decltype(std::abs((float)0)), float>::value), "");
@@ -1089,7 +1091,7 @@
static_assert((std::is_same<decltype(std::nextafterf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(std::nextafterl(0,0)), long double>::value), "");
static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), "");
- assert(std::nextafter(0,1) == 0x1p-1074);
+ assert(std::nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
}
void test_nexttoward()
@@ -1107,7 +1109,7 @@
static_assert((std::is_same<decltype(std::nexttoward((long double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(std::nexttowardf(0, (long double)0)), float>::value), "");
static_assert((std::is_same<decltype(std::nexttowardl(0, (long double)0)), long double>::value), "");
- assert(std::nexttoward(0, 1) == 0x1p-1074);
+ assert(std::nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
}
void test_remainder()
More information about the cfe-commits
mailing list