HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Nougat 7.0
|
7.0.0_r31
下载
查看原文件
收藏
根目录
external
libcxx
test
std
numerics
c.math
cmath.pass.cpp
//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// //
// NOTE: isinf and isnan are tested separately because they are expected to fail // on linux. We don't want their expected failure to hide other failures in this file. #include
#include
#include
#include "hexfloat.h" // convertible to int/float/double/etc template
struct Value { operator T () { return T(N); } }; // See PR21083 // Ambiguous is a user-defined type that defines its own overloads of cmath // functions. When the std overloads are candidates too (by using or adl), // they should not interfere. struct Ambiguous : std::true_type { // ADL operator float () { return 0.f; } operator double () { return 0.; } }; Ambiguous abs(Ambiguous){ return Ambiguous(); } Ambiguous acos(Ambiguous){ return Ambiguous(); } Ambiguous asin(Ambiguous){ return Ambiguous(); } Ambiguous atan(Ambiguous){ return Ambiguous(); } Ambiguous atan2(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous ceil(Ambiguous){ return Ambiguous(); } Ambiguous cos(Ambiguous){ return Ambiguous(); } Ambiguous cosh(Ambiguous){ return Ambiguous(); } Ambiguous exp(Ambiguous){ return Ambiguous(); } Ambiguous fabs(Ambiguous){ return Ambiguous(); } Ambiguous floor(Ambiguous){ return Ambiguous(); } Ambiguous fmod(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous frexp(Ambiguous, int*){ return Ambiguous(); } Ambiguous ldexp(Ambiguous, int){ return Ambiguous(); } Ambiguous log(Ambiguous){ return Ambiguous(); } Ambiguous log10(Ambiguous){ return Ambiguous(); } Ambiguous modf(Ambiguous, Ambiguous*){ return Ambiguous(); } Ambiguous pow(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous sin(Ambiguous){ return Ambiguous(); } Ambiguous sinh(Ambiguous){ return Ambiguous(); } Ambiguous sqrt(Ambiguous){ return Ambiguous(); } Ambiguous tan(Ambiguous){ return Ambiguous(); } Ambiguous tanh(Ambiguous){ return Ambiguous(); } Ambiguous signbit(Ambiguous){ return Ambiguous(); } Ambiguous fpclassify(Ambiguous){ return Ambiguous(); } Ambiguous isfinite(Ambiguous){ return Ambiguous(); } Ambiguous isnormal(Ambiguous){ return Ambiguous(); } Ambiguous isgreater(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous isgreaterequal(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous isless(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous islessequal(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous islessgreater(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous isunordered(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous acosh(Ambiguous){ return Ambiguous(); } Ambiguous asinh(Ambiguous){ return Ambiguous(); } Ambiguous atanh(Ambiguous){ return Ambiguous(); } Ambiguous cbrt(Ambiguous){ return Ambiguous(); } Ambiguous copysign(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous erf(Ambiguous){ return Ambiguous(); } Ambiguous erfc(Ambiguous){ return Ambiguous(); } Ambiguous exp2(Ambiguous){ return Ambiguous(); } Ambiguous expm1(Ambiguous){ return Ambiguous(); } Ambiguous fdim(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous ilogb(Ambiguous){ return Ambiguous(); } Ambiguous lgamma(Ambiguous){ return Ambiguous(); } Ambiguous llrint(Ambiguous){ return Ambiguous(); } Ambiguous llround(Ambiguous){ return Ambiguous(); } Ambiguous log1p(Ambiguous){ return Ambiguous(); } Ambiguous log2(Ambiguous){ return Ambiguous(); } Ambiguous logb(Ambiguous){ return Ambiguous(); } Ambiguous lrint(Ambiguous){ return Ambiguous(); } Ambiguous lround(Ambiguous){ return Ambiguous(); } Ambiguous nearbyint(Ambiguous){ return Ambiguous(); } Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); } Ambiguous rint(Ambiguous){ return Ambiguous(); } Ambiguous round(Ambiguous){ return Ambiguous(); } Ambiguous scalbln(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous scalbn(Ambiguous, Ambiguous){ return Ambiguous(); } Ambiguous tgamma(Ambiguous){ return Ambiguous(); } Ambiguous trunc(Ambiguous){ return Ambiguous(); } void test_abs() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::abs(-1.) == 1); } void test_acos() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::acos(1) == 0); } void test_asin() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::asin(0) == 0); } void test_atan() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::atan(0) == 0); } void test_atan2() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::atan2(0,1) == 0); } void test_ceil() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::ceil(0) == 0); } void test_cos() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::cos(0) == 1); } void test_cosh() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::cosh(0) == 1); } void test_exp() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::exp(0) == 1); } void test_fabs() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::fabs(-1) == 1); } void test_floor() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::floor(1) == 1); } void test_fmod() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::fmod(1.5,1) == .5); } void test_frexp() { int ip; static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::frexp(0, &ip) == 0); } void test_ldexp() { int ip = 1; static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::ldexp(1, ip) == 2); } void test_log() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::log(1) == 0); } void test_log10() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); assert(std::log10(1) == 0); } void test_modf() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); double i; assert(std::modf(1., &i) == 0); } void test_pow() { static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); static_assert((std::is_same
::value), ""); // static_assert((std::is_same
(), (int)0)), double>::value), ""); // static_assert((std::is_same
(), (float)0)), long double>::value), ""); // static_assert((std::is_same
())), float>::value), ""); static_assert((std::is_same