Home | History | Annotate | Download | only in c.math
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <cmath>
     11 
     12 #include <cmath>
     13 #include <type_traits>
     14 #include <cassert>
     15 
     16 #include "hexfloat.h"
     17 
     18 // convertible to int/float/double/etc
     19 template <class T, int N=0>
     20 struct Value {
     21     operator T () { return T(N); }
     22 };
     23 
     24 void test_abs()
     25 {
     26     static_assert((std::is_same<decltype(std::abs((float)0)), float>::value), "");
     27     static_assert((std::is_same<decltype(std::abs((double)0)), double>::value), "");
     28     static_assert((std::is_same<decltype(std::abs((long double)0)), long double>::value), "");
     29     assert(std::abs(-1.) == 1);
     30 }
     31 
     32 void test_acos()
     33 {
     34     static_assert((std::is_same<decltype(std::acos((float)0)), float>::value), "");
     35     static_assert((std::is_same<decltype(std::acos((bool)0)), double>::value), "");
     36     static_assert((std::is_same<decltype(std::acos((unsigned short)0)), double>::value), "");
     37     static_assert((std::is_same<decltype(std::acos((int)0)), double>::value), "");
     38     static_assert((std::is_same<decltype(std::acos((unsigned int)0)), double>::value), "");
     39     static_assert((std::is_same<decltype(std::acos((long)0)), double>::value), "");
     40     static_assert((std::is_same<decltype(std::acos((unsigned long)0)), double>::value), "");
     41     static_assert((std::is_same<decltype(std::acos((long long)0)), double>::value), "");
     42     static_assert((std::is_same<decltype(std::acos((unsigned long long)0)), double>::value), "");
     43     static_assert((std::is_same<decltype(std::acos((double)0)), double>::value), "");
     44     static_assert((std::is_same<decltype(std::acos((long double)0)), long double>::value), "");
     45     static_assert((std::is_same<decltype(std::acosf(0)), float>::value), "");
     46     static_assert((std::is_same<decltype(std::acosl(0)), long double>::value), "");
     47     assert(std::acos(1) == 0);
     48 }
     49 
     50 void test_asin()
     51 {
     52     static_assert((std::is_same<decltype(std::asin((float)0)), float>::value), "");
     53     static_assert((std::is_same<decltype(std::asin((bool)0)), double>::value), "");
     54     static_assert((std::is_same<decltype(std::asin((unsigned short)0)), double>::value), "");
     55     static_assert((std::is_same<decltype(std::asin((int)0)), double>::value), "");
     56     static_assert((std::is_same<decltype(std::asin((unsigned int)0)), double>::value), "");
     57     static_assert((std::is_same<decltype(std::asin((long)0)), double>::value), "");
     58     static_assert((std::is_same<decltype(std::asin((unsigned long)0)), double>::value), "");
     59     static_assert((std::is_same<decltype(std::asin((long long)0)), double>::value), "");
     60     static_assert((std::is_same<decltype(std::asin((unsigned long long)0)), double>::value), "");
     61     static_assert((std::is_same<decltype(std::asin((double)0)), double>::value), "");
     62     static_assert((std::is_same<decltype(std::asin((long double)0)), long double>::value), "");
     63     static_assert((std::is_same<decltype(std::asinf(0)), float>::value), "");
     64     static_assert((std::is_same<decltype(std::asinl(0)), long double>::value), "");
     65     assert(std::asin(0) == 0);
     66 }
     67 
     68 void test_atan()
     69 {
     70     static_assert((std::is_same<decltype(std::atan((float)0)), float>::value), "");
     71     static_assert((std::is_same<decltype(std::atan((bool)0)), double>::value), "");
     72     static_assert((std::is_same<decltype(std::atan((unsigned short)0)), double>::value), "");
     73     static_assert((std::is_same<decltype(std::atan((int)0)), double>::value), "");
     74     static_assert((std::is_same<decltype(std::atan((unsigned int)0)), double>::value), "");
     75     static_assert((std::is_same<decltype(std::atan((long)0)), double>::value), "");
     76     static_assert((std::is_same<decltype(std::atan((unsigned long)0)), double>::value), "");
     77     static_assert((std::is_same<decltype(std::atan((long long)0)), double>::value), "");
     78     static_assert((std::is_same<decltype(std::atan((unsigned long long)0)), double>::value), "");
     79     static_assert((std::is_same<decltype(std::atan((double)0)), double>::value), "");
     80     static_assert((std::is_same<decltype(std::atan((long double)0)), long double>::value), "");
     81     static_assert((std::is_same<decltype(std::atanf(0)), float>::value), "");
     82     static_assert((std::is_same<decltype(std::atanl(0)), long double>::value), "");
     83     assert(std::atan(0) == 0);
     84 }
     85 
     86 void test_atan2()
     87 {
     88     static_assert((std::is_same<decltype(std::atan2((float)0, (float)0)), float>::value), "");
     89     static_assert((std::is_same<decltype(std::atan2((bool)0, (float)0)), double>::value), "");
     90     static_assert((std::is_same<decltype(std::atan2((unsigned short)0, (double)0)), double>::value), "");
     91     static_assert((std::is_same<decltype(std::atan2((int)0, (long double)0)), long double>::value), "");
     92     static_assert((std::is_same<decltype(std::atan2((float)0, (unsigned int)0)), double>::value), "");
     93     static_assert((std::is_same<decltype(std::atan2((double)0, (long)0)), double>::value), "");
     94     static_assert((std::is_same<decltype(std::atan2((long double)0, (unsigned long)0)), long double>::value), "");
     95     static_assert((std::is_same<decltype(std::atan2((int)0, (long long)0)), double>::value), "");
     96     static_assert((std::is_same<decltype(std::atan2((int)0, (unsigned long long)0)), double>::value), "");
     97     static_assert((std::is_same<decltype(std::atan2((double)0, (double)0)), double>::value), "");
     98     static_assert((std::is_same<decltype(std::atan2((long double)0, (long double)0)), long double>::value), "");
     99     static_assert((std::is_same<decltype(std::atan2((float)0, (double)0)), double>::value), "");
    100     static_assert((std::is_same<decltype(std::atan2((float)0, (long double)0)), long double>::value), "");
    101     static_assert((std::is_same<decltype(std::atan2((double)0, (long double)0)), long double>::value), "");
    102     static_assert((std::is_same<decltype(std::atan2f(0,0)), float>::value), "");
    103     static_assert((std::is_same<decltype(std::atan2l(0,0)), long double>::value), "");
    104     static_assert((std::is_same<decltype(std::atan2((int)0, (int)0)), double>::value), "");
    105     assert(std::atan2(0,1) == 0);
    106 }
    107 
    108 void test_ceil()
    109 {
    110     static_assert((std::is_same<decltype(std::ceil((float)0)), float>::value), "");
    111     static_assert((std::is_same<decltype(std::ceil((bool)0)), double>::value), "");
    112     static_assert((std::is_same<decltype(std::ceil((unsigned short)0)), double>::value), "");
    113     static_assert((std::is_same<decltype(std::ceil((int)0)), double>::value), "");
    114     static_assert((std::is_same<decltype(std::ceil((unsigned int)0)), double>::value), "");
    115     static_assert((std::is_same<decltype(std::ceil((long)0)), double>::value), "");
    116     static_assert((std::is_same<decltype(std::ceil((unsigned long)0)), double>::value), "");
    117     static_assert((std::is_same<decltype(std::ceil((long long)0)), double>::value), "");
    118     static_assert((std::is_same<decltype(std::ceil((unsigned long long)0)), double>::value), "");
    119     static_assert((std::is_same<decltype(std::ceil((double)0)), double>::value), "");
    120     static_assert((std::is_same<decltype(std::ceil((long double)0)), long double>::value), "");
    121     static_assert((std::is_same<decltype(std::ceilf(0)), float>::value), "");
    122     static_assert((std::is_same<decltype(std::ceill(0)), long double>::value), "");
    123     assert(std::ceil(0) == 0);
    124 }
    125 
    126 void test_cos()
    127 {
    128     static_assert((std::is_same<decltype(std::cos((float)0)), float>::value), "");
    129     static_assert((std::is_same<decltype(std::cos((bool)0)), double>::value), "");
    130     static_assert((std::is_same<decltype(std::cos((unsigned short)0)), double>::value), "");
    131     static_assert((std::is_same<decltype(std::cos((int)0)), double>::value), "");
    132     static_assert((std::is_same<decltype(std::cos((unsigned int)0)), double>::value), "");
    133     static_assert((std::is_same<decltype(std::cos((long)0)), double>::value), "");
    134     static_assert((std::is_same<decltype(std::cos((unsigned long)0)), double>::value), "");
    135     static_assert((std::is_same<decltype(std::cos((long long)0)), double>::value), "");
    136     static_assert((std::is_same<decltype(std::cos((unsigned long long)0)), double>::value), "");
    137     static_assert((std::is_same<decltype(std::cos((double)0)), double>::value), "");
    138     static_assert((std::is_same<decltype(std::cos((long double)0)), long double>::value), "");
    139     static_assert((std::is_same<decltype(std::cosf(0)), float>::value), "");
    140     static_assert((std::is_same<decltype(std::cosl(0)), long double>::value), "");
    141     assert(std::cos(0) == 1);
    142 }
    143 
    144 void test_cosh()
    145 {
    146     static_assert((std::is_same<decltype(std::cosh((float)0)), float>::value), "");
    147     static_assert((std::is_same<decltype(std::cosh((bool)0)), double>::value), "");
    148     static_assert((std::is_same<decltype(std::cosh((unsigned short)0)), double>::value), "");
    149     static_assert((std::is_same<decltype(std::cosh((int)0)), double>::value), "");
    150     static_assert((std::is_same<decltype(std::cosh((unsigned int)0)), double>::value), "");
    151     static_assert((std::is_same<decltype(std::cosh((long)0)), double>::value), "");
    152     static_assert((std::is_same<decltype(std::cosh((unsigned long)0)), double>::value), "");
    153     static_assert((std::is_same<decltype(std::cosh((long long)0)), double>::value), "");
    154     static_assert((std::is_same<decltype(std::cosh((unsigned long long)0)), double>::value), "");
    155     static_assert((std::is_same<decltype(std::cosh((double)0)), double>::value), "");
    156     static_assert((std::is_same<decltype(std::cosh((long double)0)), long double>::value), "");
    157     static_assert((std::is_same<decltype(std::coshf(0)), float>::value), "");
    158     static_assert((std::is_same<decltype(std::coshl(0)), long double>::value), "");
    159     assert(std::cosh(0) == 1);
    160 }
    161 
    162 void test_exp()
    163 {
    164     static_assert((std::is_same<decltype(std::exp((float)0)), float>::value), "");
    165     static_assert((std::is_same<decltype(std::exp((bool)0)), double>::value), "");
    166     static_assert((std::is_same<decltype(std::exp((unsigned short)0)), double>::value), "");
    167     static_assert((std::is_same<decltype(std::exp((int)0)), double>::value), "");
    168     static_assert((std::is_same<decltype(std::exp((unsigned int)0)), double>::value), "");
    169     static_assert((std::is_same<decltype(std::exp((long)0)), double>::value), "");
    170     static_assert((std::is_same<decltype(std::exp((unsigned long)0)), double>::value), "");
    171     static_assert((std::is_same<decltype(std::exp((long long)0)), double>::value), "");
    172     static_assert((std::is_same<decltype(std::exp((unsigned long long)0)), double>::value), "");
    173     static_assert((std::is_same<decltype(std::exp((double)0)), double>::value), "");
    174     static_assert((std::is_same<decltype(std::exp((long double)0)), long double>::value), "");
    175     static_assert((std::is_same<decltype(std::expf(0)), float>::value), "");
    176     static_assert((std::is_same<decltype(std::expl(0)), long double>::value), "");
    177     assert(std::exp(0) == 1);
    178 }
    179 
    180 void test_fabs()
    181 {
    182     static_assert((std::is_same<decltype(std::fabs((float)0)), float>::value), "");
    183     static_assert((std::is_same<decltype(std::fabs((bool)0)), double>::value), "");
    184     static_assert((std::is_same<decltype(std::fabs((unsigned short)0)), double>::value), "");
    185     static_assert((std::is_same<decltype(std::fabs((int)0)), double>::value), "");
    186     static_assert((std::is_same<decltype(std::fabs((unsigned int)0)), double>::value), "");
    187     static_assert((std::is_same<decltype(std::fabs((long)0)), double>::value), "");
    188     static_assert((std::is_same<decltype(std::fabs((unsigned long)0)), double>::value), "");
    189     static_assert((std::is_same<decltype(std::fabs((long long)0)), double>::value), "");
    190     static_assert((std::is_same<decltype(std::fabs((unsigned long long)0)), double>::value), "");
    191     static_assert((std::is_same<decltype(std::fabs((double)0)), double>::value), "");
    192     static_assert((std::is_same<decltype(std::fabs((long double)0)), long double>::value), "");
    193     static_assert((std::is_same<decltype(std::fabsf(0.0f)), float>::value), "");
    194     static_assert((std::is_same<decltype(std::fabsl(0.0L)), long double>::value), "");
    195     assert(std::fabs(-1) == 1);
    196 }
    197 
    198 void test_floor()
    199 {
    200     static_assert((std::is_same<decltype(std::floor((float)0)), float>::value), "");
    201     static_assert((std::is_same<decltype(std::floor((bool)0)), double>::value), "");
    202     static_assert((std::is_same<decltype(std::floor((unsigned short)0)), double>::value), "");
    203     static_assert((std::is_same<decltype(std::floor((int)0)), double>::value), "");
    204     static_assert((std::is_same<decltype(std::floor((unsigned int)0)), double>::value), "");
    205     static_assert((std::is_same<decltype(std::floor((long)0)), double>::value), "");
    206     static_assert((std::is_same<decltype(std::floor((unsigned long)0)), double>::value), "");
    207     static_assert((std::is_same<decltype(std::floor((long long)0)), double>::value), "");
    208     static_assert((std::is_same<decltype(std::floor((unsigned long long)0)), double>::value), "");
    209     static_assert((std::is_same<decltype(std::floor((double)0)), double>::value), "");
    210     static_assert((std::is_same<decltype(std::floor((long double)0)), long double>::value), "");
    211     static_assert((std::is_same<decltype(std::floorf(0)), float>::value), "");
    212     static_assert((std::is_same<decltype(std::floorl(0)), long double>::value), "");
    213     assert(std::floor(1) == 1);
    214 }
    215 
    216 void test_fmod()
    217 {
    218     static_assert((std::is_same<decltype(std::fmod((float)0, (float)0)), float>::value), "");
    219     static_assert((std::is_same<decltype(std::fmod((bool)0, (float)0)), double>::value), "");
    220     static_assert((std::is_same<decltype(std::fmod((unsigned short)0, (double)0)), double>::value), "");
    221     static_assert((std::is_same<decltype(std::fmod((int)0, (long double)0)), long double>::value), "");
    222     static_assert((std::is_same<decltype(std::fmod((float)0, (unsigned int)0)), double>::value), "");
    223     static_assert((std::is_same<decltype(std::fmod((double)0, (long)0)), double>::value), "");
    224     static_assert((std::is_same<decltype(std::fmod((long double)0, (unsigned long)0)), long double>::value), "");
    225     static_assert((std::is_same<decltype(std::fmod((int)0, (long long)0)), double>::value), "");
    226     static_assert((std::is_same<decltype(std::fmod((int)0, (unsigned long long)0)), double>::value), "");
    227     static_assert((std::is_same<decltype(std::fmod((double)0, (double)0)), double>::value), "");
    228     static_assert((std::is_same<decltype(std::fmod((long double)0, (long double)0)), long double>::value), "");
    229     static_assert((std::is_same<decltype(std::fmod((float)0, (double)0)), double>::value), "");
    230     static_assert((std::is_same<decltype(std::fmod((float)0, (long double)0)), long double>::value), "");
    231     static_assert((std::is_same<decltype(std::fmod((double)0, (long double)0)), long double>::value), "");
    232     static_assert((std::is_same<decltype(std::fmodf(0,0)), float>::value), "");
    233     static_assert((std::is_same<decltype(std::fmodl(0,0)), long double>::value), "");
    234     static_assert((std::is_same<decltype(std::fmod((int)0, (int)0)), double>::value), "");
    235     assert(std::fmod(1.5,1) == .5);
    236 }
    237 
    238 void test_frexp()
    239 {
    240     int ip;
    241     static_assert((std::is_same<decltype(std::frexp((float)0, &ip)), float>::value), "");
    242     static_assert((std::is_same<decltype(std::frexp((bool)0, &ip)), double>::value), "");
    243     static_assert((std::is_same<decltype(std::frexp((unsigned short)0, &ip)), double>::value), "");
    244     static_assert((std::is_same<decltype(std::frexp((int)0, &ip)), double>::value), "");
    245     static_assert((std::is_same<decltype(std::frexp((unsigned int)0, &ip)), double>::value), "");
    246     static_assert((std::is_same<decltype(std::frexp((long)0, &ip)), double>::value), "");
    247     static_assert((std::is_same<decltype(std::frexp((unsigned long)0, &ip)), double>::value), "");
    248     static_assert((std::is_same<decltype(std::frexp((long long)0, &ip)), double>::value), "");
    249     static_assert((std::is_same<decltype(std::frexp((unsigned long long)0, &ip)), double>::value), "");
    250     static_assert((std::is_same<decltype(std::frexp((double)0, &ip)), double>::value), "");
    251     static_assert((std::is_same<decltype(std::frexp((long double)0, &ip)), long double>::value), "");
    252     static_assert((std::is_same<decltype(std::frexpf(0, &ip)), float>::value), "");
    253     static_assert((std::is_same<decltype(std::frexpl(0, &ip)), long double>::value), "");
    254     assert(std::frexp(0, &ip) == 0);
    255 }
    256 
    257 void test_ldexp()
    258 {
    259     int ip = 1;
    260     static_assert((std::is_same<decltype(std::ldexp((float)0, ip)), float>::value), "");
    261     static_assert((std::is_same<decltype(std::ldexp((bool)0, ip)), double>::value), "");
    262     static_assert((std::is_same<decltype(std::ldexp((unsigned short)0, ip)), double>::value), "");
    263     static_assert((std::is_same<decltype(std::ldexp((int)0, ip)), double>::value), "");
    264     static_assert((std::is_same<decltype(std::ldexp((unsigned int)0, ip)), double>::value), "");
    265     static_assert((std::is_same<decltype(std::ldexp((long)0, ip)), double>::value), "");
    266     static_assert((std::is_same<decltype(std::ldexp((unsigned long)0, ip)), double>::value), "");
    267     static_assert((std::is_same<decltype(std::ldexp((long long)0, ip)), double>::value), "");
    268     static_assert((std::is_same<decltype(std::ldexp((unsigned long long)0, ip)), double>::value), "");
    269     static_assert((std::is_same<decltype(std::ldexp((double)0, ip)), double>::value), "");
    270     static_assert((std::is_same<decltype(std::ldexp((long double)0, ip)), long double>::value), "");
    271     static_assert((std::is_same<decltype(std::ldexpf(0, ip)), float>::value), "");
    272     static_assert((std::is_same<decltype(std::ldexpl(0, ip)), long double>::value), "");
    273     assert(std::ldexp(1, ip) == 2);
    274 }
    275 
    276 void test_log()
    277 {
    278     static_assert((std::is_same<decltype(std::log((float)0)), float>::value), "");
    279     static_assert((std::is_same<decltype(std::log((bool)0)), double>::value), "");
    280     static_assert((std::is_same<decltype(std::log((unsigned short)0)), double>::value), "");
    281     static_assert((std::is_same<decltype(std::log((int)0)), double>::value), "");
    282     static_assert((std::is_same<decltype(std::log((unsigned int)0)), double>::value), "");
    283     static_assert((std::is_same<decltype(std::log((long)0)), double>::value), "");
    284     static_assert((std::is_same<decltype(std::log((unsigned long)0)), double>::value), "");
    285     static_assert((std::is_same<decltype(std::log((long long)0)), double>::value), "");
    286     static_assert((std::is_same<decltype(std::log((unsigned long long)0)), double>::value), "");
    287     static_assert((std::is_same<decltype(std::log((double)0)), double>::value), "");
    288     static_assert((std::is_same<decltype(std::log((long double)0)), long double>::value), "");
    289     static_assert((std::is_same<decltype(std::logf(0)), float>::value), "");
    290     static_assert((std::is_same<decltype(std::logl(0)), long double>::value), "");
    291     assert(std::log(1) == 0);
    292 }
    293 
    294 void test_log10()
    295 {
    296     static_assert((std::is_same<decltype(std::log10((float)0)), float>::value), "");
    297     static_assert((std::is_same<decltype(std::log10((bool)0)), double>::value), "");
    298     static_assert((std::is_same<decltype(std::log10((unsigned short)0)), double>::value), "");
    299     static_assert((std::is_same<decltype(std::log10((int)0)), double>::value), "");
    300     static_assert((std::is_same<decltype(std::log10((unsigned int)0)), double>::value), "");
    301     static_assert((std::is_same<decltype(std::log10((long)0)), double>::value), "");
    302     static_assert((std::is_same<decltype(std::log10((unsigned long)0)), double>::value), "");
    303     static_assert((std::is_same<decltype(std::log10((long long)0)), double>::value), "");
    304     static_assert((std::is_same<decltype(std::log10((unsigned long long)0)), double>::value), "");
    305     static_assert((std::is_same<decltype(std::log10((double)0)), double>::value), "");
    306     static_assert((std::is_same<decltype(std::log10((long double)0)), long double>::value), "");
    307     static_assert((std::is_same<decltype(std::log10f(0)), float>::value), "");
    308     static_assert((std::is_same<decltype(std::log10l(0)), long double>::value), "");
    309     assert(std::log10(1) == 0);
    310 }
    311 
    312 void test_modf()
    313 {
    314     static_assert((std::is_same<decltype(std::modf((float)0, (float*)0)), float>::value), "");
    315     static_assert((std::is_same<decltype(std::modf((double)0, (double*)0)), double>::value), "");
    316     static_assert((std::is_same<decltype(std::modf((long double)0, (long double*)0)), long double>::value), "");
    317     static_assert((std::is_same<decltype(std::modff(0, (float*)0)), float>::value), "");
    318     static_assert((std::is_same<decltype(std::modfl(0, (long double*)0)), long double>::value), "");
    319     double i;
    320     assert(std::modf(1., &i) == 0);
    321 }
    322 
    323 void test_pow()
    324 {
    325     static_assert((std::is_same<decltype(std::pow((float)0, (float)0)), float>::value), "");
    326     static_assert((std::is_same<decltype(std::pow((bool)0, (float)0)), double>::value), "");
    327     static_assert((std::is_same<decltype(std::pow((unsigned short)0, (double)0)), double>::value), "");
    328     static_assert((std::is_same<decltype(std::pow((int)0, (long double)0)), long double>::value), "");
    329     static_assert((std::is_same<decltype(std::pow((float)0, (unsigned int)0)), double>::value), "");
    330     static_assert((std::is_same<decltype(std::pow((double)0, (long)0)), double>::value), "");
    331     static_assert((std::is_same<decltype(std::pow((long double)0, (unsigned long)0)), long double>::value), "");
    332     static_assert((std::is_same<decltype(std::pow((int)0, (long long)0)), double>::value), "");
    333     static_assert((std::is_same<decltype(std::pow((int)0, (unsigned long long)0)), double>::value), "");
    334     static_assert((std::is_same<decltype(std::pow((double)0, (double)0)), double>::value), "");
    335     static_assert((std::is_same<decltype(std::pow((long double)0, (long double)0)), long double>::value), "");
    336     static_assert((std::is_same<decltype(std::pow((float)0, (double)0)), double>::value), "");
    337     static_assert((std::is_same<decltype(std::pow((float)0, (long double)0)), long double>::value), "");
    338     static_assert((std::is_same<decltype(std::pow((double)0, (long double)0)), long double>::value), "");
    339     static_assert((std::is_same<decltype(std::powf(0,0)), float>::value), "");
    340     static_assert((std::is_same<decltype(std::powl(0,0)), long double>::value), "");
    341     static_assert((std::is_same<decltype(std::pow((int)0, (int)0)), double>::value), "");
    342 //     static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
    343 //     static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
    344 //     static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
    345     assert(std::pow(1,1) == 1);
    346 //     assert(std::pow(Value<int,1>(), Value<float,1>())  == 1);
    347 //     assert(std::pow(1.0f, Value<double,1>()) == 1);
    348 //     assert(std::pow(1.0, Value<int,1>()) == 1);
    349 //     assert(std::pow(Value<long double,1>(), 1LL) == 1);
    350 }
    351 
    352 void test_sin()
    353 {
    354     static_assert((std::is_same<decltype(std::sin((float)0)), float>::value), "");
    355     static_assert((std::is_same<decltype(std::sin((bool)0)), double>::value), "");
    356     static_assert((std::is_same<decltype(std::sin((unsigned short)0)), double>::value), "");
    357     static_assert((std::is_same<decltype(std::sin((int)0)), double>::value), "");
    358     static_assert((std::is_same<decltype(std::sin((unsigned int)0)), double>::value), "");
    359     static_assert((std::is_same<decltype(std::sin((long)0)), double>::value), "");
    360     static_assert((std::is_same<decltype(std::sin((unsigned long)0)), double>::value), "");
    361     static_assert((std::is_same<decltype(std::sin((long long)0)), double>::value), "");
    362     static_assert((std::is_same<decltype(std::sin((unsigned long long)0)), double>::value), "");
    363     static_assert((std::is_same<decltype(std::sin((double)0)), double>::value), "");
    364     static_assert((std::is_same<decltype(std::sin((long double)0)), long double>::value), "");
    365     static_assert((std::is_same<decltype(std::sinf(0)), float>::value), "");
    366     static_assert((std::is_same<decltype(std::sinl(0)), long double>::value), "");
    367     assert(std::sin(0) == 0);
    368 }
    369 
    370 void test_sinh()
    371 {
    372     static_assert((std::is_same<decltype(std::sinh((float)0)), float>::value), "");
    373     static_assert((std::is_same<decltype(std::sinh((bool)0)), double>::value), "");
    374     static_assert((std::is_same<decltype(std::sinh((unsigned short)0)), double>::value), "");
    375     static_assert((std::is_same<decltype(std::sinh((int)0)), double>::value), "");
    376     static_assert((std::is_same<decltype(std::sinh((unsigned int)0)), double>::value), "");
    377     static_assert((std::is_same<decltype(std::sinh((long)0)), double>::value), "");
    378     static_assert((std::is_same<decltype(std::sinh((unsigned long)0)), double>::value), "");
    379     static_assert((std::is_same<decltype(std::sinh((long long)0)), double>::value), "");
    380     static_assert((std::is_same<decltype(std::sinh((unsigned long long)0)), double>::value), "");
    381     static_assert((std::is_same<decltype(std::sinh((double)0)), double>::value), "");
    382     static_assert((std::is_same<decltype(std::sinh((long double)0)), long double>::value), "");
    383     static_assert((std::is_same<decltype(std::sinhf(0)), float>::value), "");
    384     static_assert((std::is_same<decltype(std::sinhl(0)), long double>::value), "");
    385     assert(std::sinh(0) == 0);
    386 }
    387 
    388 void test_sqrt()
    389 {
    390     static_assert((std::is_same<decltype(std::sqrt((float)0)), float>::value), "");
    391     static_assert((std::is_same<decltype(std::sqrt((bool)0)), double>::value), "");
    392     static_assert((std::is_same<decltype(std::sqrt((unsigned short)0)), double>::value), "");
    393     static_assert((std::is_same<decltype(std::sqrt((int)0)), double>::value), "");
    394     static_assert((std::is_same<decltype(std::sqrt((unsigned int)0)), double>::value), "");
    395     static_assert((std::is_same<decltype(std::sqrt((long)0)), double>::value), "");
    396     static_assert((std::is_same<decltype(std::sqrt((unsigned long)0)), double>::value), "");
    397     static_assert((std::is_same<decltype(std::sqrt((long long)0)), double>::value), "");
    398     static_assert((std::is_same<decltype(std::sqrt((unsigned long long)0)), double>::value), "");
    399     static_assert((std::is_same<decltype(std::sqrt((double)0)), double>::value), "");
    400     static_assert((std::is_same<decltype(std::sqrt((long double)0)), long double>::value), "");
    401     static_assert((std::is_same<decltype(std::sqrtf(0)), float>::value), "");
    402     static_assert((std::is_same<decltype(std::sqrtl(0)), long double>::value), "");
    403     assert(std::sqrt(4) == 2);
    404 }
    405 
    406 void test_tan()
    407 {
    408     static_assert((std::is_same<decltype(std::tan((float)0)), float>::value), "");
    409     static_assert((std::is_same<decltype(std::tan((bool)0)), double>::value), "");
    410     static_assert((std::is_same<decltype(std::tan((unsigned short)0)), double>::value), "");
    411     static_assert((std::is_same<decltype(std::tan((int)0)), double>::value), "");
    412     static_assert((std::is_same<decltype(std::tan((unsigned int)0)), double>::value), "");
    413     static_assert((std::is_same<decltype(std::tan((long)0)), double>::value), "");
    414     static_assert((std::is_same<decltype(std::tan((unsigned long)0)), double>::value), "");
    415     static_assert((std::is_same<decltype(std::tan((long long)0)), double>::value), "");
    416     static_assert((std::is_same<decltype(std::tan((unsigned long long)0)), double>::value), "");
    417     static_assert((std::is_same<decltype(std::tan((double)0)), double>::value), "");
    418     static_assert((std::is_same<decltype(std::tan((long double)0)), long double>::value), "");
    419     static_assert((std::is_same<decltype(std::tanf(0)), float>::value), "");
    420     static_assert((std::is_same<decltype(std::tanl(0)), long double>::value), "");
    421     assert(std::tan(0) == 0);
    422 }
    423 
    424 void test_tanh()
    425 {
    426     static_assert((std::is_same<decltype(std::tanh((float)0)), float>::value), "");
    427     static_assert((std::is_same<decltype(std::tanh((bool)0)), double>::value), "");
    428     static_assert((std::is_same<decltype(std::tanh((unsigned short)0)), double>::value), "");
    429     static_assert((std::is_same<decltype(std::tanh((int)0)), double>::value), "");
    430     static_assert((std::is_same<decltype(std::tanh((unsigned int)0)), double>::value), "");
    431     static_assert((std::is_same<decltype(std::tanh((long)0)), double>::value), "");
    432     static_assert((std::is_same<decltype(std::tanh((unsigned long)0)), double>::value), "");
    433     static_assert((std::is_same<decltype(std::tanh((long long)0)), double>::value), "");
    434     static_assert((std::is_same<decltype(std::tanh((unsigned long long)0)), double>::value), "");
    435     static_assert((std::is_same<decltype(std::tanh((double)0)), double>::value), "");
    436     static_assert((std::is_same<decltype(std::tanh((long double)0)), long double>::value), "");
    437     static_assert((std::is_same<decltype(std::tanhf(0)), float>::value), "");
    438     static_assert((std::is_same<decltype(std::tanhl(0)), long double>::value), "");
    439     assert(std::tanh(0) == 0);
    440 }
    441 
    442 void test_signbit()
    443 {
    444 #ifdef signbit
    445 #error signbit defined
    446 #endif
    447     static_assert((std::is_same<decltype(std::signbit((float)0)), bool>::value), "");
    448     static_assert((std::is_same<decltype(std::signbit((double)0)), bool>::value), "");
    449     static_assert((std::is_same<decltype(std::signbit(0)), bool>::value), "");
    450     static_assert((std::is_same<decltype(std::signbit((long double)0)), bool>::value), "");
    451     assert(std::signbit(-1.0) == true);
    452 }
    453 
    454 void test_fpclassify()
    455 {
    456 #ifdef fpclassify
    457 #error fpclassify defined
    458 #endif
    459     static_assert((std::is_same<decltype(std::fpclassify((float)0)), int>::value), "");
    460     static_assert((std::is_same<decltype(std::fpclassify((double)0)), int>::value), "");
    461     static_assert((std::is_same<decltype(std::fpclassify(0)), int>::value), "");
    462     static_assert((std::is_same<decltype(std::fpclassify((long double)0)), int>::value), "");
    463     assert(std::fpclassify(-1.0) == FP_NORMAL);
    464 }
    465 
    466 void test_isfinite()
    467 {
    468 #ifdef isfinite
    469 #error isfinite defined
    470 #endif
    471     static_assert((std::is_same<decltype(std::isfinite((float)0)), bool>::value), "");
    472     static_assert((std::is_same<decltype(std::isfinite((double)0)), bool>::value), "");
    473     static_assert((std::is_same<decltype(std::isfinite(0)), bool>::value), "");
    474     static_assert((std::is_same<decltype(std::isfinite((long double)0)), bool>::value), "");
    475     assert(std::isfinite(-1.0) == true);
    476 }
    477 
    478 void test_isinf()
    479 {
    480 #ifdef isinf
    481 #error isinf defined
    482 #endif
    483     static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
    484 #if !(defined(__ANDROID__) && (__LP64__ || __ANDROID_API__ >= 21))
    485  // bionic isnan(double) returns int.
    486     static_assert((std::is_same<decltype(std::isinf((double)0)), bool>::value), "");
    487 #endif
    488     static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");
    489     static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");
    490     assert(std::isinf(-1.0) == false);
    491 }
    492 
    493 void test_isnan()
    494 {
    495 #ifdef isnan
    496 #error isnan defined
    497 #endif
    498     static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
    499 #if !defined(__ANDROID__)
    500  // bionic isnan(double) returns int.  Not sure how isnan(float) and isnan(long double) pass.
    501  // Mask this check to reveal/fix more seirous one: eg. lack of log2 and nettoward, etc
    502 
    503     static_assert((std::is_same<decltype(std::isnan((double)0)), bool>::value), "");
    504     static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");
    505 #endif
    506     static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");
    507     assert(std::isnan(-1.0) == false);
    508 }
    509 
    510 void test_isnormal()
    511 {
    512 #ifdef isnormal
    513 #error isnormal defined
    514 #endif
    515     static_assert((std::is_same<decltype(std::isnormal((float)0)), bool>::value), "");
    516     static_assert((std::is_same<decltype(std::isnormal((double)0)), bool>::value), "");
    517     static_assert((std::is_same<decltype(std::isnormal(0)), bool>::value), "");
    518     static_assert((std::is_same<decltype(std::isnormal((long double)0)), bool>::value), "");
    519     assert(std::isnormal(-1.0) == true);
    520 }
    521 
    522 void test_isgreater()
    523 {
    524 #ifdef isgreater
    525 #error isgreater defined
    526 #endif
    527     static_assert((std::is_same<decltype(std::isgreater((float)0, (float)0)), bool>::value), "");
    528     static_assert((std::is_same<decltype(std::isgreater((float)0, (double)0)), bool>::value), "");
    529     static_assert((std::is_same<decltype(std::isgreater((float)0, (long double)0)), bool>::value), "");
    530     static_assert((std::is_same<decltype(std::isgreater((double)0, (float)0)), bool>::value), "");
    531     static_assert((std::is_same<decltype(std::isgreater((double)0, (double)0)), bool>::value), "");
    532     static_assert((std::is_same<decltype(std::isgreater(0, (double)0)), bool>::value), "");
    533     static_assert((std::is_same<decltype(std::isgreater((double)0, (long double)0)), bool>::value), "");
    534     static_assert((std::is_same<decltype(std::isgreater((long double)0, (float)0)), bool>::value), "");
    535     static_assert((std::is_same<decltype(std::isgreater((long double)0, (double)0)), bool>::value), "");
    536     static_assert((std::is_same<decltype(std::isgreater((long double)0, (long double)0)), bool>::value), "");
    537     assert(std::isgreater(-1.0, 0.F) == false);
    538 }
    539 
    540 void test_isgreaterequal()
    541 {
    542 #ifdef isgreaterequal
    543 #error isgreaterequal defined
    544 #endif
    545     static_assert((std::is_same<decltype(std::isgreaterequal((float)0, (float)0)), bool>::value), "");
    546     static_assert((std::is_same<decltype(std::isgreaterequal((float)0, (double)0)), bool>::value), "");
    547     static_assert((std::is_same<decltype(std::isgreaterequal((float)0, (long double)0)), bool>::value), "");
    548     static_assert((std::is_same<decltype(std::isgreaterequal((double)0, (float)0)), bool>::value), "");
    549     static_assert((std::is_same<decltype(std::isgreaterequal((double)0, (double)0)), bool>::value), "");
    550     static_assert((std::is_same<decltype(std::isgreaterequal(0, (double)0)), bool>::value), "");
    551     static_assert((std::is_same<decltype(std::isgreaterequal((double)0, (long double)0)), bool>::value), "");
    552     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (float)0)), bool>::value), "");
    553     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (double)0)), bool>::value), "");
    554     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (long double)0)), bool>::value), "");
    555     assert(std::isgreaterequal(-1.0, 0.F) == false);
    556 }
    557 
    558 void test_isless()
    559 {
    560 #ifdef isless
    561 #error isless defined
    562 #endif
    563     static_assert((std::is_same<decltype(std::isless((float)0, (float)0)), bool>::value), "");
    564     static_assert((std::is_same<decltype(std::isless((float)0, (double)0)), bool>::value), "");
    565     static_assert((std::is_same<decltype(std::isless((float)0, (long double)0)), bool>::value), "");
    566     static_assert((std::is_same<decltype(std::isless((double)0, (float)0)), bool>::value), "");
    567     static_assert((std::is_same<decltype(std::isless((double)0, (double)0)), bool>::value), "");
    568     static_assert((std::is_same<decltype(std::isless(0, (double)0)), bool>::value), "");
    569     static_assert((std::is_same<decltype(std::isless((double)0, (long double)0)), bool>::value), "");
    570     static_assert((std::is_same<decltype(std::isless((long double)0, (float)0)), bool>::value), "");
    571     static_assert((std::is_same<decltype(std::isless((long double)0, (double)0)), bool>::value), "");
    572     static_assert((std::is_same<decltype(std::isless((long double)0, (long double)0)), bool>::value), "");
    573     assert(std::isless(-1.0, 0.F) == true);
    574 }
    575 
    576 void test_islessequal()
    577 {
    578 #ifdef islessequal
    579 #error islessequal defined
    580 #endif
    581     static_assert((std::is_same<decltype(std::islessequal((float)0, (float)0)), bool>::value), "");
    582     static_assert((std::is_same<decltype(std::islessequal((float)0, (double)0)), bool>::value), "");
    583     static_assert((std::is_same<decltype(std::islessequal((float)0, (long double)0)), bool>::value), "");
    584     static_assert((std::is_same<decltype(std::islessequal((double)0, (float)0)), bool>::value), "");
    585     static_assert((std::is_same<decltype(std::islessequal((double)0, (double)0)), bool>::value), "");
    586     static_assert((std::is_same<decltype(std::islessequal(0, (double)0)), bool>::value), "");
    587     static_assert((std::is_same<decltype(std::islessequal((double)0, (long double)0)), bool>::value), "");
    588     static_assert((std::is_same<decltype(std::islessequal((long double)0, (float)0)), bool>::value), "");
    589     static_assert((std::is_same<decltype(std::islessequal((long double)0, (double)0)), bool>::value), "");
    590     static_assert((std::is_same<decltype(std::islessequal((long double)0, (long double)0)), bool>::value), "");
    591     assert(std::islessequal(-1.0, 0.F) == true);
    592 }
    593 
    594 void test_islessgreater()
    595 {
    596 #ifdef islessgreater
    597 #error islessgreater defined
    598 #endif
    599     static_assert((std::is_same<decltype(std::islessgreater((float)0, (float)0)), bool>::value), "");
    600     static_assert((std::is_same<decltype(std::islessgreater((float)0, (double)0)), bool>::value), "");
    601     static_assert((std::is_same<decltype(std::islessgreater((float)0, (long double)0)), bool>::value), "");
    602     static_assert((std::is_same<decltype(std::islessgreater((double)0, (float)0)), bool>::value), "");
    603     static_assert((std::is_same<decltype(std::islessgreater((double)0, (double)0)), bool>::value), "");
    604     static_assert((std::is_same<decltype(std::islessgreater(0, (double)0)), bool>::value), "");
    605     static_assert((std::is_same<decltype(std::islessgreater((double)0, (long double)0)), bool>::value), "");
    606     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (float)0)), bool>::value), "");
    607     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (double)0)), bool>::value), "");
    608     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (long double)0)), bool>::value), "");
    609     assert(std::islessgreater(-1.0, 0.F) == true);
    610 }
    611 
    612 void test_isunordered()
    613 {
    614 #ifdef isunordered
    615 #error isunordered defined
    616 #endif
    617     static_assert((std::is_same<decltype(std::isunordered((float)0, (float)0)), bool>::value), "");
    618     static_assert((std::is_same<decltype(std::isunordered((float)0, (double)0)), bool>::value), "");
    619     static_assert((std::is_same<decltype(std::isunordered((float)0, (long double)0)), bool>::value), "");
    620     static_assert((std::is_same<decltype(std::isunordered((double)0, (float)0)), bool>::value), "");
    621     static_assert((std::is_same<decltype(std::isunordered((double)0, (double)0)), bool>::value), "");
    622     static_assert((std::is_same<decltype(std::isunordered(0, (double)0)), bool>::value), "");
    623     static_assert((std::is_same<decltype(std::isunordered((double)0, (long double)0)), bool>::value), "");
    624     static_assert((std::is_same<decltype(std::isunordered((long double)0, (float)0)), bool>::value), "");
    625     static_assert((std::is_same<decltype(std::isunordered((long double)0, (double)0)), bool>::value), "");
    626     static_assert((std::is_same<decltype(std::isunordered((long double)0, (long double)0)), bool>::value), "");
    627     assert(std::isunordered(-1.0, 0.F) == false);
    628 }
    629 
    630 void test_acosh()
    631 {
    632     static_assert((std::is_same<decltype(std::acosh((float)0)), float>::value), "");
    633     static_assert((std::is_same<decltype(std::acosh((bool)0)), double>::value), "");
    634     static_assert((std::is_same<decltype(std::acosh((unsigned short)0)), double>::value), "");
    635     static_assert((std::is_same<decltype(std::acosh((int)0)), double>::value), "");
    636     static_assert((std::is_same<decltype(std::acosh((unsigned int)0)), double>::value), "");
    637     static_assert((std::is_same<decltype(std::acosh((long)0)), double>::value), "");
    638     static_assert((std::is_same<decltype(std::acosh((unsigned long)0)), double>::value), "");
    639     static_assert((std::is_same<decltype(std::acosh((long long)0)), double>::value), "");
    640     static_assert((std::is_same<decltype(std::acosh((unsigned long long)0)), double>::value), "");
    641     static_assert((std::is_same<decltype(std::acosh((double)0)), double>::value), "");
    642     static_assert((std::is_same<decltype(std::acosh((long double)0)), long double>::value), "");
    643     static_assert((std::is_same<decltype(std::acoshf(0)), float>::value), "");
    644     static_assert((std::is_same<decltype(std::acoshl(0)), long double>::value), "");
    645     assert(std::acosh(1) == 0);
    646 }
    647 
    648 void test_asinh()
    649 {
    650     static_assert((std::is_same<decltype(std::asinh((float)0)), float>::value), "");
    651     static_assert((std::is_same<decltype(std::asinh((bool)0)), double>::value), "");
    652     static_assert((std::is_same<decltype(std::asinh((unsigned short)0)), double>::value), "");
    653     static_assert((std::is_same<decltype(std::asinh((int)0)), double>::value), "");
    654     static_assert((std::is_same<decltype(std::asinh((unsigned int)0)), double>::value), "");
    655     static_assert((std::is_same<decltype(std::asinh((long)0)), double>::value), "");
    656     static_assert((std::is_same<decltype(std::asinh((unsigned long)0)), double>::value), "");
    657     static_assert((std::is_same<decltype(std::asinh((long long)0)), double>::value), "");
    658     static_assert((std::is_same<decltype(std::asinh((unsigned long long)0)), double>::value), "");
    659     static_assert((std::is_same<decltype(std::asinh((double)0)), double>::value), "");
    660     static_assert((std::is_same<decltype(std::asinh((long double)0)), long double>::value), "");
    661     static_assert((std::is_same<decltype(std::asinhf(0)), float>::value), "");
    662     static_assert((std::is_same<decltype(std::asinhl(0)), long double>::value), "");
    663     assert(std::asinh(0) == 0);
    664 }
    665 
    666 void test_atanh()
    667 {
    668     static_assert((std::is_same<decltype(std::atanh((float)0)), float>::value), "");
    669     static_assert((std::is_same<decltype(std::atanh((bool)0)), double>::value), "");
    670     static_assert((std::is_same<decltype(std::atanh((unsigned short)0)), double>::value), "");
    671     static_assert((std::is_same<decltype(std::atanh((int)0)), double>::value), "");
    672     static_assert((std::is_same<decltype(std::atanh((unsigned int)0)), double>::value), "");
    673     static_assert((std::is_same<decltype(std::atanh((long)0)), double>::value), "");
    674     static_assert((std::is_same<decltype(std::atanh((unsigned long)0)), double>::value), "");
    675     static_assert((std::is_same<decltype(std::atanh((long long)0)), double>::value), "");
    676     static_assert((std::is_same<decltype(std::atanh((unsigned long long)0)), double>::value), "");
    677     static_assert((std::is_same<decltype(std::atanh((double)0)), double>::value), "");
    678     static_assert((std::is_same<decltype(std::atanh((long double)0)), long double>::value), "");
    679     static_assert((std::is_same<decltype(std::atanhf(0)), float>::value), "");
    680     static_assert((std::is_same<decltype(std::atanhl(0)), long double>::value), "");
    681     assert(std::atanh(0) == 0);
    682 }
    683 
    684 void test_cbrt()
    685 {
    686     static_assert((std::is_same<decltype(std::cbrt((float)0)), float>::value), "");
    687     static_assert((std::is_same<decltype(std::cbrt((bool)0)), double>::value), "");
    688     static_assert((std::is_same<decltype(std::cbrt((unsigned short)0)), double>::value), "");
    689     static_assert((std::is_same<decltype(std::cbrt((int)0)), double>::value), "");
    690     static_assert((std::is_same<decltype(std::cbrt((unsigned int)0)), double>::value), "");
    691     static_assert((std::is_same<decltype(std::cbrt((long)0)), double>::value), "");
    692     static_assert((std::is_same<decltype(std::cbrt((unsigned long)0)), double>::value), "");
    693     static_assert((std::is_same<decltype(std::cbrt((long long)0)), double>::value), "");
    694     static_assert((std::is_same<decltype(std::cbrt((unsigned long long)0)), double>::value), "");
    695     static_assert((std::is_same<decltype(std::cbrt((double)0)), double>::value), "");
    696     static_assert((std::is_same<decltype(std::cbrt((long double)0)), long double>::value), "");
    697     static_assert((std::is_same<decltype(std::cbrtf(0)), float>::value), "");
    698     static_assert((std::is_same<decltype(std::cbrtl(0)), long double>::value), "");
    699     assert(std::cbrt(1) == 1);
    700 }
    701 
    702 void test_copysign()
    703 {
    704     static_assert((std::is_same<decltype(std::copysign((float)0, (float)0)), float>::value), "");
    705     static_assert((std::is_same<decltype(std::copysign((bool)0, (float)0)), double>::value), "");
    706     static_assert((std::is_same<decltype(std::copysign((unsigned short)0, (double)0)), double>::value), "");
    707     static_assert((std::is_same<decltype(std::copysign((int)0, (long double)0)), long double>::value), "");
    708     static_assert((std::is_same<decltype(std::copysign((float)0, (unsigned int)0)), double>::value), "");
    709     static_assert((std::is_same<decltype(std::copysign((double)0, (long)0)), double>::value), "");
    710     static_assert((std::is_same<decltype(std::copysign((long double)0, (unsigned long)0)), long double>::value), "");
    711     static_assert((std::is_same<decltype(std::copysign((int)0, (long long)0)), double>::value), "");
    712     static_assert((std::is_same<decltype(std::copysign((int)0, (unsigned long long)0)), double>::value), "");
    713     static_assert((std::is_same<decltype(std::copysign((double)0, (double)0)), double>::value), "");
    714     static_assert((std::is_same<decltype(std::copysign((long double)0, (long double)0)), long double>::value), "");
    715     static_assert((std::is_same<decltype(std::copysign((float)0, (double)0)), double>::value), "");
    716     static_assert((std::is_same<decltype(std::copysign((float)0, (long double)0)), long double>::value), "");
    717     static_assert((std::is_same<decltype(std::copysign((double)0, (long double)0)), long double>::value), "");
    718     static_assert((std::is_same<decltype(std::copysignf(0,0)), float>::value), "");
    719     static_assert((std::is_same<decltype(std::copysignl(0,0)), long double>::value), "");
    720     static_assert((std::is_same<decltype(std::copysign((int)0, (int)0)), double>::value), "");
    721     assert(std::copysign(1,1) == 1);
    722 }
    723 
    724 void test_erf()
    725 {
    726     static_assert((std::is_same<decltype(std::erf((float)0)), float>::value), "");
    727     static_assert((std::is_same<decltype(std::erf((bool)0)), double>::value), "");
    728     static_assert((std::is_same<decltype(std::erf((unsigned short)0)), double>::value), "");
    729     static_assert((std::is_same<decltype(std::erf((int)0)), double>::value), "");
    730     static_assert((std::is_same<decltype(std::erf((unsigned int)0)), double>::value), "");
    731     static_assert((std::is_same<decltype(std::erf((long)0)), double>::value), "");
    732     static_assert((std::is_same<decltype(std::erf((unsigned long)0)), double>::value), "");
    733     static_assert((std::is_same<decltype(std::erf((long long)0)), double>::value), "");
    734     static_assert((std::is_same<decltype(std::erf((unsigned long long)0)), double>::value), "");
    735     static_assert((std::is_same<decltype(std::erf((double)0)), double>::value), "");
    736     static_assert((std::is_same<decltype(std::erf((long double)0)), long double>::value), "");
    737     static_assert((std::is_same<decltype(std::erff(0)), float>::value), "");
    738     static_assert((std::is_same<decltype(std::erfl(0)), long double>::value), "");
    739     assert(std::erf(0) == 0);
    740 }
    741 
    742 void test_erfc()
    743 {
    744     static_assert((std::is_same<decltype(std::erfc((float)0)), float>::value), "");
    745     static_assert((std::is_same<decltype(std::erfc((bool)0)), double>::value), "");
    746     static_assert((std::is_same<decltype(std::erfc((unsigned short)0)), double>::value), "");
    747     static_assert((std::is_same<decltype(std::erfc((int)0)), double>::value), "");
    748     static_assert((std::is_same<decltype(std::erfc((unsigned int)0)), double>::value), "");
    749     static_assert((std::is_same<decltype(std::erfc((long)0)), double>::value), "");
    750     static_assert((std::is_same<decltype(std::erfc((unsigned long)0)), double>::value), "");
    751     static_assert((std::is_same<decltype(std::erfc((long long)0)), double>::value), "");
    752     static_assert((std::is_same<decltype(std::erfc((unsigned long long)0)), double>::value), "");
    753     static_assert((std::is_same<decltype(std::erfc((double)0)), double>::value), "");
    754     static_assert((std::is_same<decltype(std::erfc((long double)0)), long double>::value), "");
    755     static_assert((std::is_same<decltype(std::erfcf(0)), float>::value), "");
    756     static_assert((std::is_same<decltype(std::erfcl(0)), long double>::value), "");
    757     assert(std::erfc(0) == 1);
    758 }
    759 
    760 void test_exp2()
    761 {
    762     static_assert((std::is_same<decltype(std::exp2((float)0)), float>::value), "");
    763     static_assert((std::is_same<decltype(std::exp2((bool)0)), double>::value), "");
    764     static_assert((std::is_same<decltype(std::exp2((unsigned short)0)), double>::value), "");
    765     static_assert((std::is_same<decltype(std::exp2((int)0)), double>::value), "");
    766     static_assert((std::is_same<decltype(std::exp2((unsigned int)0)), double>::value), "");
    767     static_assert((std::is_same<decltype(std::exp2((long)0)), double>::value), "");
    768     static_assert((std::is_same<decltype(std::exp2((unsigned long)0)), double>::value), "");
    769     static_assert((std::is_same<decltype(std::exp2((long long)0)), double>::value), "");
    770     static_assert((std::is_same<decltype(std::exp2((unsigned long long)0)), double>::value), "");
    771     static_assert((std::is_same<decltype(std::exp2((double)0)), double>::value), "");
    772     static_assert((std::is_same<decltype(std::exp2((long double)0)), long double>::value), "");
    773     static_assert((std::is_same<decltype(std::exp2f(0)), float>::value), "");
    774     static_assert((std::is_same<decltype(std::exp2l(0)), long double>::value), "");
    775     assert(std::exp2(1) == 2);
    776 }
    777 
    778 void test_expm1()
    779 {
    780     static_assert((std::is_same<decltype(std::expm1((float)0)), float>::value), "");
    781     static_assert((std::is_same<decltype(std::expm1((bool)0)), double>::value), "");
    782     static_assert((std::is_same<decltype(std::expm1((unsigned short)0)), double>::value), "");
    783     static_assert((std::is_same<decltype(std::expm1((int)0)), double>::value), "");
    784     static_assert((std::is_same<decltype(std::expm1((unsigned int)0)), double>::value), "");
    785     static_assert((std::is_same<decltype(std::expm1((long)0)), double>::value), "");
    786     static_assert((std::is_same<decltype(std::expm1((unsigned long)0)), double>::value), "");
    787     static_assert((std::is_same<decltype(std::expm1((long long)0)), double>::value), "");
    788     static_assert((std::is_same<decltype(std::expm1((unsigned long long)0)), double>::value), "");
    789     static_assert((std::is_same<decltype(std::expm1((double)0)), double>::value), "");
    790     static_assert((std::is_same<decltype(std::expm1((long double)0)), long double>::value), "");
    791     static_assert((std::is_same<decltype(std::expm1f(0)), float>::value), "");
    792     static_assert((std::is_same<decltype(std::expm1l(0)), long double>::value), "");
    793     assert(std::expm1(0) == 0);
    794 }
    795 
    796 void test_fdim()
    797 {
    798     static_assert((std::is_same<decltype(std::fdim((float)0, (float)0)), float>::value), "");
    799     static_assert((std::is_same<decltype(std::fdim((bool)0, (float)0)), double>::value), "");
    800     static_assert((std::is_same<decltype(std::fdim((unsigned short)0, (double)0)), double>::value), "");
    801     static_assert((std::is_same<decltype(std::fdim((int)0, (long double)0)), long double>::value), "");
    802     static_assert((std::is_same<decltype(std::fdim((float)0, (unsigned int)0)), double>::value), "");
    803     static_assert((std::is_same<decltype(std::fdim((double)0, (long)0)), double>::value), "");
    804     static_assert((std::is_same<decltype(std::fdim((long double)0, (unsigned long)0)), long double>::value), "");
    805     static_assert((std::is_same<decltype(std::fdim((int)0, (long long)0)), double>::value), "");
    806     static_assert((std::is_same<decltype(std::fdim((int)0, (unsigned long long)0)), double>::value), "");
    807     static_assert((std::is_same<decltype(std::fdim((double)0, (double)0)), double>::value), "");
    808     static_assert((std::is_same<decltype(std::fdim((long double)0, (long double)0)), long double>::value), "");
    809     static_assert((std::is_same<decltype(std::fdim((float)0, (double)0)), double>::value), "");
    810     static_assert((std::is_same<decltype(std::fdim((float)0, (long double)0)), long double>::value), "");
    811     static_assert((std::is_same<decltype(std::fdim((double)0, (long double)0)), long double>::value), "");
    812     static_assert((std::is_same<decltype(std::fdimf(0,0)), float>::value), "");
    813     static_assert((std::is_same<decltype(std::fdiml(0,0)), long double>::value), "");
    814     static_assert((std::is_same<decltype(std::fdim((int)0, (int)0)), double>::value), "");
    815     assert(std::fdim(1,0) == 1);
    816 }
    817 
    818 void test_fma()
    819 {
    820     static_assert((std::is_same<decltype(std::fma((bool)0, (float)0, (float)0)), double>::value), "");
    821     static_assert((std::is_same<decltype(std::fma((char)0, (float)0, (float)0)), double>::value), "");
    822     static_assert((std::is_same<decltype(std::fma((unsigned)0, (float)0, (float)0)), double>::value), "");
    823     static_assert((std::is_same<decltype(std::fma((float)0, (int)0, (float)0)), double>::value), "");
    824     static_assert((std::is_same<decltype(std::fma((float)0, (long)0, (float)0)), double>::value), "");
    825     static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (unsigned long long)0)), double>::value), "");
    826     static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (double)0)), double>::value), "");
    827     static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (long double)0)), long double>::value), "");
    828     static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (float)0)), float>::value), "");
    829 
    830     static_assert((std::is_same<decltype(std::fma((bool)0, (double)0, (double)0)), double>::value), "");
    831     static_assert((std::is_same<decltype(std::fma((char)0, (double)0, (double)0)), double>::value), "");
    832     static_assert((std::is_same<decltype(std::fma((unsigned)0, (double)0, (double)0)), double>::value), "");
    833     static_assert((std::is_same<decltype(std::fma((double)0, (int)0, (double)0)), double>::value), "");
    834     static_assert((std::is_same<decltype(std::fma((double)0, (long)0, (double)0)), double>::value), "");
    835     static_assert((std::is_same<decltype(std::fma((double)0, (double)0, (unsigned long long)0)), double>::value), "");
    836     static_assert((std::is_same<decltype(std::fma((double)0, (double)0, (float)0)), double>::value), "");
    837     static_assert((std::is_same<decltype(std::fma((double)0, (double)0, (long double)0)), long double>::value), "");
    838     static_assert((std::is_same<decltype(std::fma((double)0, (double)0,  (double)0)), double>::value), "");
    839 
    840     static_assert((std::is_same<decltype(std::fma((bool)0, (long double)0, (long double)0)), long double>::value), "");
    841     static_assert((std::is_same<decltype(std::fma((char)0, (long double)0, (long double)0)), long double>::value), "");
    842     static_assert((std::is_same<decltype(std::fma((unsigned)0, (long double)0, (long double)0)), long double>::value), "");
    843     static_assert((std::is_same<decltype(std::fma((long double)0, (int)0, (long double)0)), long double>::value), "");
    844     static_assert((std::is_same<decltype(std::fma((long double)0, (long)0, (long double)0)), long double>::value), "");
    845     static_assert((std::is_same<decltype(std::fma((long double)0, (long double)0, (unsigned long long)0)), long double>::value), "");
    846     static_assert((std::is_same<decltype(std::fma((long double)0, (long double)0, (float)0)), long double>::value), "");
    847     static_assert((std::is_same<decltype(std::fma((double)0, (long double)0, (long double)0)), long double>::value), "");
    848     static_assert((std::is_same<decltype(std::fma((long double)0, (long double)0, (long double)0)), long double>::value), "");
    849 
    850     static_assert((std::is_same<decltype(std::fmaf(0,0,0)), float>::value), "");
    851     static_assert((std::is_same<decltype(std::fmal(0,0,0)), long double>::value), "");
    852     assert(std::fma(1,1,1) == 2);
    853 }
    854 
    855 void test_fmax()
    856 {
    857     static_assert((std::is_same<decltype(std::fmax((float)0, (float)0)), float>::value), "");
    858     static_assert((std::is_same<decltype(std::fmax((bool)0, (float)0)), double>::value), "");
    859     static_assert((std::is_same<decltype(std::fmax((unsigned short)0, (double)0)), double>::value), "");
    860     static_assert((std::is_same<decltype(std::fmax((int)0, (long double)0)), long double>::value), "");
    861     static_assert((std::is_same<decltype(std::fmax((float)0, (unsigned int)0)), double>::value), "");
    862     static_assert((std::is_same<decltype(std::fmax((double)0, (long)0)), double>::value), "");
    863     static_assert((std::is_same<decltype(std::fmax((long double)0, (unsigned long)0)), long double>::value), "");
    864     static_assert((std::is_same<decltype(std::fmax((int)0, (long long)0)), double>::value), "");
    865     static_assert((std::is_same<decltype(std::fmax((int)0, (unsigned long long)0)), double>::value), "");
    866     static_assert((std::is_same<decltype(std::fmax((double)0, (double)0)), double>::value), "");
    867     static_assert((std::is_same<decltype(std::fmax((long double)0, (long double)0)), long double>::value), "");
    868     static_assert((std::is_same<decltype(std::fmax((float)0, (double)0)), double>::value), "");
    869     static_assert((std::is_same<decltype(std::fmax((float)0, (long double)0)), long double>::value), "");
    870     static_assert((std::is_same<decltype(std::fmax((double)0, (long double)0)), long double>::value), "");
    871     static_assert((std::is_same<decltype(std::fmaxf(0,0)), float>::value), "");
    872     static_assert((std::is_same<decltype(std::fmaxl(0,0)), long double>::value), "");
    873     static_assert((std::is_same<decltype(std::fmax((int)0, (int)0)), double>::value), "");
    874     assert(std::fmax(1,0) == 1);
    875 }
    876 
    877 void test_fmin()
    878 {
    879     static_assert((std::is_same<decltype(std::fmin((float)0, (float)0)), float>::value), "");
    880     static_assert((std::is_same<decltype(std::fmin((bool)0, (float)0)), double>::value), "");
    881     static_assert((std::is_same<decltype(std::fmin((unsigned short)0, (double)0)), double>::value), "");
    882     static_assert((std::is_same<decltype(std::fmin((int)0, (long double)0)), long double>::value), "");
    883     static_assert((std::is_same<decltype(std::fmin((float)0, (unsigned int)0)), double>::value), "");
    884     static_assert((std::is_same<decltype(std::fmin((double)0, (long)0)), double>::value), "");
    885     static_assert((std::is_same<decltype(std::fmin((long double)0, (unsigned long)0)), long double>::value), "");
    886     static_assert((std::is_same<decltype(std::fmin((int)0, (long long)0)), double>::value), "");
    887     static_assert((std::is_same<decltype(std::fmin((int)0, (unsigned long long)0)), double>::value), "");
    888     static_assert((std::is_same<decltype(std::fmin((double)0, (double)0)), double>::value), "");
    889     static_assert((std::is_same<decltype(std::fmin((long double)0, (long double)0)), long double>::value), "");
    890     static_assert((std::is_same<decltype(std::fmin((float)0, (double)0)), double>::value), "");
    891     static_assert((std::is_same<decltype(std::fmin((float)0, (long double)0)), long double>::value), "");
    892     static_assert((std::is_same<decltype(std::fmin((double)0, (long double)0)), long double>::value), "");
    893     static_assert((std::is_same<decltype(std::fminf(0,0)), float>::value), "");
    894     static_assert((std::is_same<decltype(std::fminl(0,0)), long double>::value), "");
    895     static_assert((std::is_same<decltype(std::fmin((int)0, (int)0)), double>::value), "");
    896     assert(std::fmin(1,0) == 0);
    897 }
    898 
    899 void test_hypot()
    900 {
    901     static_assert((std::is_same<decltype(std::hypot((float)0, (float)0)), float>::value), "");
    902     static_assert((std::is_same<decltype(std::hypot((bool)0, (float)0)), double>::value), "");
    903     static_assert((std::is_same<decltype(std::hypot((unsigned short)0, (double)0)), double>::value), "");
    904     static_assert((std::is_same<decltype(std::hypot((int)0, (long double)0)), long double>::value), "");
    905     static_assert((std::is_same<decltype(std::hypot((float)0, (unsigned int)0)), double>::value), "");
    906     static_assert((std::is_same<decltype(std::hypot((double)0, (long)0)), double>::value), "");
    907     static_assert((std::is_same<decltype(std::hypot((long double)0, (unsigned long)0)), long double>::value), "");
    908     static_assert((std::is_same<decltype(std::hypot((int)0, (long long)0)), double>::value), "");
    909     static_assert((std::is_same<decltype(std::hypot((int)0, (unsigned long long)0)), double>::value), "");
    910     static_assert((std::is_same<decltype(std::hypot((double)0, (double)0)), double>::value), "");
    911     static_assert((std::is_same<decltype(std::hypot((long double)0, (long double)0)), long double>::value), "");
    912     static_assert((std::is_same<decltype(std::hypot((float)0, (double)0)), double>::value), "");
    913     static_assert((std::is_same<decltype(std::hypot((float)0, (long double)0)), long double>::value), "");
    914     static_assert((std::is_same<decltype(std::hypot((double)0, (long double)0)), long double>::value), "");
    915     static_assert((std::is_same<decltype(std::hypotf(0,0)), float>::value), "");
    916     static_assert((std::is_same<decltype(std::hypotl(0,0)), long double>::value), "");
    917     static_assert((std::is_same<decltype(std::hypot((int)0, (int)0)), double>::value), "");
    918     assert(std::hypot(3,4) == 5);
    919 }
    920 
    921 void test_ilogb()
    922 {
    923     static_assert((std::is_same<decltype(std::ilogb((float)0)), int>::value), "");
    924     static_assert((std::is_same<decltype(std::ilogb((bool)0)), int>::value), "");
    925     static_assert((std::is_same<decltype(std::ilogb((unsigned short)0)), int>::value), "");
    926     static_assert((std::is_same<decltype(std::ilogb((int)0)), int>::value), "");
    927     static_assert((std::is_same<decltype(std::ilogb((unsigned int)0)), int>::value), "");
    928     static_assert((std::is_same<decltype(std::ilogb((long)0)), int>::value), "");
    929     static_assert((std::is_same<decltype(std::ilogb((unsigned long)0)), int>::value), "");
    930     static_assert((std::is_same<decltype(std::ilogb((long long)0)), int>::value), "");
    931     static_assert((std::is_same<decltype(std::ilogb((unsigned long long)0)), int>::value), "");
    932     static_assert((std::is_same<decltype(std::ilogb((double)0)), int>::value), "");
    933     static_assert((std::is_same<decltype(std::ilogb((long double)0)), int>::value), "");
    934     static_assert((std::is_same<decltype(std::ilogbf(0)), int>::value), "");
    935     static_assert((std::is_same<decltype(std::ilogbl(0)), int>::value), "");
    936     assert(std::ilogb(1) == 0);
    937 }
    938 
    939 void test_lgamma()
    940 {
    941     static_assert((std::is_same<decltype(std::lgamma((float)0)), float>::value), "");
    942     static_assert((std::is_same<decltype(std::lgamma((bool)0)), double>::value), "");
    943     static_assert((std::is_same<decltype(std::lgamma((unsigned short)0)), double>::value), "");
    944     static_assert((std::is_same<decltype(std::lgamma((int)0)), double>::value), "");
    945     static_assert((std::is_same<decltype(std::lgamma((unsigned int)0)), double>::value), "");
    946     static_assert((std::is_same<decltype(std::lgamma((long)0)), double>::value), "");
    947     static_assert((std::is_same<decltype(std::lgamma((unsigned long)0)), double>::value), "");
    948     static_assert((std::is_same<decltype(std::lgamma((long long)0)), double>::value), "");
    949     static_assert((std::is_same<decltype(std::lgamma((unsigned long long)0)), double>::value), "");
    950     static_assert((std::is_same<decltype(std::lgamma((double)0)), double>::value), "");
    951     static_assert((std::is_same<decltype(std::lgamma((long double)0)), long double>::value), "");
    952     static_assert((std::is_same<decltype(std::lgammaf(0)), float>::value), "");
    953     static_assert((std::is_same<decltype(std::lgammal(0)), long double>::value), "");
    954     assert(std::lgamma(1) == 0);
    955 }
    956 
    957 void test_llrint()
    958 {
    959     static_assert((std::is_same<decltype(std::llrint((float)0)), long long>::value), "");
    960     static_assert((std::is_same<decltype(std::llrint((bool)0)), long long>::value), "");
    961     static_assert((std::is_same<decltype(std::llrint((unsigned short)0)), long long>::value), "");
    962     static_assert((std::is_same<decltype(std::llrint((int)0)), long long>::value), "");
    963     static_assert((std::is_same<decltype(std::llrint((unsigned int)0)), long long>::value), "");
    964     static_assert((std::is_same<decltype(std::llrint((long)0)), long long>::value), "");
    965     static_assert((std::is_same<decltype(std::llrint((unsigned long)0)), long long>::value), "");
    966     static_assert((std::is_same<decltype(std::llrint((long long)0)), long long>::value), "");
    967     static_assert((std::is_same<decltype(std::llrint((unsigned long long)0)), long long>::value), "");
    968     static_assert((std::is_same<decltype(std::llrint((double)0)), long long>::value), "");
    969     static_assert((std::is_same<decltype(std::llrint((long double)0)), long long>::value), "");
    970     static_assert((std::is_same<decltype(std::llrintf(0)), long long>::value), "");
    971     static_assert((std::is_same<decltype(std::llrintl(0)), long long>::value), "");
    972     assert(std::llrint(1) == 1LL);
    973 }
    974 
    975 void test_llround()
    976 {
    977     static_assert((std::is_same<decltype(std::llround((float)0)), long long>::value), "");
    978     static_assert((std::is_same<decltype(std::llround((bool)0)), long long>::value), "");
    979     static_assert((std::is_same<decltype(std::llround((unsigned short)0)), long long>::value), "");
    980     static_assert((std::is_same<decltype(std::llround((int)0)), long long>::value), "");
    981     static_assert((std::is_same<decltype(std::llround((unsigned int)0)), long long>::value), "");
    982     static_assert((std::is_same<decltype(std::llround((long)0)), long long>::value), "");
    983     static_assert((std::is_same<decltype(std::llround((unsigned long)0)), long long>::value), "");
    984     static_assert((std::is_same<decltype(std::llround((long long)0)), long long>::value), "");
    985     static_assert((std::is_same<decltype(std::llround((unsigned long long)0)), long long>::value), "");
    986     static_assert((std::is_same<decltype(std::llround((double)0)), long long>::value), "");
    987     static_assert((std::is_same<decltype(std::llround((long double)0)), long long>::value), "");
    988     static_assert((std::is_same<decltype(std::llroundf(0)), long long>::value), "");
    989     static_assert((std::is_same<decltype(std::llroundl(0)), long long>::value), "");
    990     assert(std::llround(1) == 1LL);
    991 }
    992 
    993 void test_log1p()
    994 {
    995     static_assert((std::is_same<decltype(std::log1p((float)0)), float>::value), "");
    996     static_assert((std::is_same<decltype(std::log1p((bool)0)), double>::value), "");
    997     static_assert((std::is_same<decltype(std::log1p((unsigned short)0)), double>::value), "");
    998     static_assert((std::is_same<decltype(std::log1p((int)0)), double>::value), "");
    999     static_assert((std::is_same<decltype(std::log1p((unsigned int)0)), double>::value), "");
   1000     static_assert((std::is_same<decltype(std::log1p((long)0)), double>::value), "");
   1001     static_assert((std::is_same<decltype(std::log1p((unsigned long)0)), double>::value), "");
   1002     static_assert((std::is_same<decltype(std::log1p((long long)0)), double>::value), "");
   1003     static_assert((std::is_same<decltype(std::log1p((unsigned long long)0)), double>::value), "");
   1004     static_assert((std::is_same<decltype(std::log1p((double)0)), double>::value), "");
   1005     static_assert((std::is_same<decltype(std::log1p((long double)0)), long double>::value), "");
   1006     static_assert((std::is_same<decltype(std::log1pf(0)), float>::value), "");
   1007     static_assert((std::is_same<decltype(std::log1pl(0)), long double>::value), "");
   1008     assert(std::log1p(0) == 0);
   1009 }
   1010 
   1011 void test_log2()
   1012 {
   1013     static_assert((std::is_same<decltype(std::log2((float)0)), float>::value), "");
   1014     static_assert((std::is_same<decltype(std::log2((bool)0)), double>::value), "");
   1015     static_assert((std::is_same<decltype(std::log2((unsigned short)0)), double>::value), "");
   1016     static_assert((std::is_same<decltype(std::log2((int)0)), double>::value), "");
   1017     static_assert((std::is_same<decltype(std::log2((unsigned int)0)), double>::value), "");
   1018     static_assert((std::is_same<decltype(std::log2((long)0)), double>::value), "");
   1019     static_assert((std::is_same<decltype(std::log2((unsigned long)0)), double>::value), "");
   1020     static_assert((std::is_same<decltype(std::log2((long long)0)), double>::value), "");
   1021     static_assert((std::is_same<decltype(std::log2((unsigned long long)0)), double>::value), "");
   1022     static_assert((std::is_same<decltype(std::log2((double)0)), double>::value), "");
   1023     static_assert((std::is_same<decltype(std::log2((long double)0)), long double>::value), "");
   1024     static_assert((std::is_same<decltype(std::log2f(0)), float>::value), "");
   1025     static_assert((std::is_same<decltype(std::log2l(0)), long double>::value), "");
   1026     assert(std::log2(1) == 0);
   1027 }
   1028 
   1029 void test_logb()
   1030 {
   1031     static_assert((std::is_same<decltype(std::logb((float)0)), float>::value), "");
   1032     static_assert((std::is_same<decltype(std::logb((bool)0)), double>::value), "");
   1033     static_assert((std::is_same<decltype(std::logb((unsigned short)0)), double>::value), "");
   1034     static_assert((std::is_same<decltype(std::logb((int)0)), double>::value), "");
   1035     static_assert((std::is_same<decltype(std::logb((unsigned int)0)), double>::value), "");
   1036     static_assert((std::is_same<decltype(std::logb((long)0)), double>::value), "");
   1037     static_assert((std::is_same<decltype(std::logb((unsigned long)0)), double>::value), "");
   1038     static_assert((std::is_same<decltype(std::logb((long long)0)), double>::value), "");
   1039     static_assert((std::is_same<decltype(std::logb((unsigned long long)0)), double>::value), "");
   1040     static_assert((std::is_same<decltype(std::logb((double)0)), double>::value), "");
   1041     static_assert((std::is_same<decltype(std::logb((long double)0)), long double>::value), "");
   1042     static_assert((std::is_same<decltype(std::logbf(0)), float>::value), "");
   1043     static_assert((std::is_same<decltype(std::logbl(0)), long double>::value), "");
   1044     assert(std::logb(1) == 0);
   1045 }
   1046 
   1047 void test_lrint()
   1048 {
   1049     static_assert((std::is_same<decltype(std::lrint((float)0)), long>::value), "");
   1050     static_assert((std::is_same<decltype(std::lrint((bool)0)), long>::value), "");
   1051     static_assert((std::is_same<decltype(std::lrint((unsigned short)0)), long>::value), "");
   1052     static_assert((std::is_same<decltype(std::lrint((int)0)), long>::value), "");
   1053     static_assert((std::is_same<decltype(std::lrint((unsigned int)0)), long>::value), "");
   1054     static_assert((std::is_same<decltype(std::lrint((long)0)), long>::value), "");
   1055     static_assert((std::is_same<decltype(std::lrint((unsigned long)0)), long>::value), "");
   1056     static_assert((std::is_same<decltype(std::lrint((long long)0)), long>::value), "");
   1057     static_assert((std::is_same<decltype(std::lrint((unsigned long long)0)), long>::value), "");
   1058     static_assert((std::is_same<decltype(std::lrint((double)0)), long>::value), "");
   1059     static_assert((std::is_same<decltype(std::lrint((long double)0)), long>::value), "");
   1060     static_assert((std::is_same<decltype(std::lrintf(0)), long>::value), "");
   1061     static_assert((std::is_same<decltype(std::lrintl(0)), long>::value), "");
   1062     assert(std::lrint(1) == 1L);
   1063 }
   1064 
   1065 void test_lround()
   1066 {
   1067     static_assert((std::is_same<decltype(std::lround((float)0)), long>::value), "");
   1068     static_assert((std::is_same<decltype(std::lround((bool)0)), long>::value), "");
   1069     static_assert((std::is_same<decltype(std::lround((unsigned short)0)), long>::value), "");
   1070     static_assert((std::is_same<decltype(std::lround((int)0)), long>::value), "");
   1071     static_assert((std::is_same<decltype(std::lround((unsigned int)0)), long>::value), "");
   1072     static_assert((std::is_same<decltype(std::lround((long)0)), long>::value), "");
   1073     static_assert((std::is_same<decltype(std::lround((unsigned long)0)), long>::value), "");
   1074     static_assert((std::is_same<decltype(std::lround((long long)0)), long>::value), "");
   1075     static_assert((std::is_same<decltype(std::lround((unsigned long long)0)), long>::value), "");
   1076     static_assert((std::is_same<decltype(std::lround((double)0)), long>::value), "");
   1077     static_assert((std::is_same<decltype(std::lround((long double)0)), long>::value), "");
   1078     static_assert((std::is_same<decltype(std::lroundf(0)), long>::value), "");
   1079     static_assert((std::is_same<decltype(std::lroundl(0)), long>::value), "");
   1080     assert(std::lround(1) == 1L);
   1081 }
   1082 
   1083 void test_nan()
   1084 {
   1085     static_assert((std::is_same<decltype(std::nan("")), double>::value), "");
   1086     static_assert((std::is_same<decltype(std::nanf("")), float>::value), "");
   1087     static_assert((std::is_same<decltype(std::nanl("")), long double>::value), "");
   1088 }
   1089 
   1090 void test_nearbyint()
   1091 {
   1092     static_assert((std::is_same<decltype(std::nearbyint((float)0)), float>::value), "");
   1093     static_assert((std::is_same<decltype(std::nearbyint((bool)0)), double>::value), "");
   1094     static_assert((std::is_same<decltype(std::nearbyint((unsigned short)0)), double>::value), "");
   1095     static_assert((std::is_same<decltype(std::nearbyint((int)0)), double>::value), "");
   1096     static_assert((std::is_same<decltype(std::nearbyint((unsigned int)0)), double>::value), "");
   1097     static_assert((std::is_same<decltype(std::nearbyint((long)0)), double>::value), "");
   1098     static_assert((std::is_same<decltype(std::nearbyint((unsigned long)0)), double>::value), "");
   1099     static_assert((std::is_same<decltype(std::nearbyint((long long)0)), double>::value), "");
   1100     static_assert((std::is_same<decltype(std::nearbyint((unsigned long long)0)), double>::value), "");
   1101     static_assert((std::is_same<decltype(std::nearbyint((double)0)), double>::value), "");
   1102     static_assert((std::is_same<decltype(std::nearbyint((long double)0)), long double>::value), "");
   1103     static_assert((std::is_same<decltype(std::nearbyintf(0)), float>::value), "");
   1104     static_assert((std::is_same<decltype(std::nearbyintl(0)), long double>::value), "");
   1105     assert(std::nearbyint(1) == 1);
   1106 }
   1107 
   1108 void test_nextafter()
   1109 {
   1110     static_assert((std::is_same<decltype(std::nextafter((float)0, (float)0)), float>::value), "");
   1111     static_assert((std::is_same<decltype(std::nextafter((bool)0, (float)0)), double>::value), "");
   1112     static_assert((std::is_same<decltype(std::nextafter((unsigned short)0, (double)0)), double>::value), "");
   1113     static_assert((std::is_same<decltype(std::nextafter((int)0, (long double)0)), long double>::value), "");
   1114     static_assert((std::is_same<decltype(std::nextafter((float)0, (unsigned int)0)), double>::value), "");
   1115     static_assert((std::is_same<decltype(std::nextafter((double)0, (long)0)), double>::value), "");
   1116     static_assert((std::is_same<decltype(std::nextafter((long double)0, (unsigned long)0)), long double>::value), "");
   1117     static_assert((std::is_same<decltype(std::nextafter((int)0, (long long)0)), double>::value), "");
   1118     static_assert((std::is_same<decltype(std::nextafter((int)0, (unsigned long long)0)), double>::value), "");
   1119     static_assert((std::is_same<decltype(std::nextafter((double)0, (double)0)), double>::value), "");
   1120     static_assert((std::is_same<decltype(std::nextafter((long double)0, (long double)0)), long double>::value), "");
   1121     static_assert((std::is_same<decltype(std::nextafter((float)0, (double)0)), double>::value), "");
   1122     static_assert((std::is_same<decltype(std::nextafter((float)0, (long double)0)), long double>::value), "");
   1123     static_assert((std::is_same<decltype(std::nextafter((double)0, (long double)0)), long double>::value), "");
   1124     static_assert((std::is_same<decltype(std::nextafterf(0,0)), float>::value), "");
   1125     static_assert((std::is_same<decltype(std::nextafterl(0,0)), long double>::value), "");
   1126     static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), "");
   1127     assert(std::nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
   1128 }
   1129 
   1130 void test_nexttoward()
   1131 {
   1132     static_assert((std::is_same<decltype(std::nexttoward((float)0, (long double)0)), float>::value), "");
   1133     static_assert((std::is_same<decltype(std::nexttoward((bool)0, (long double)0)), double>::value), "");
   1134     static_assert((std::is_same<decltype(std::nexttoward((unsigned short)0, (long double)0)), double>::value), "");
   1135     static_assert((std::is_same<decltype(std::nexttoward((int)0, (long double)0)), double>::value), "");
   1136     static_assert((std::is_same<decltype(std::nexttoward((unsigned int)0, (long double)0)), double>::value), "");
   1137     static_assert((std::is_same<decltype(std::nexttoward((long)0, (long double)0)), double>::value), "");
   1138     static_assert((std::is_same<decltype(std::nexttoward((unsigned long)0, (long double)0)), double>::value), "");
   1139     static_assert((std::is_same<decltype(std::nexttoward((long long)0, (long double)0)), double>::value), "");
   1140     static_assert((std::is_same<decltype(std::nexttoward((unsigned long long)0, (long double)0)), double>::value), "");
   1141     static_assert((std::is_same<decltype(std::nexttoward((double)0, (long double)0)), double>::value), "");
   1142     static_assert((std::is_same<decltype(std::nexttoward((long double)0, (long double)0)), long double>::value), "");
   1143     static_assert((std::is_same<decltype(std::nexttowardf(0, (long double)0)), float>::value), "");
   1144     static_assert((std::is_same<decltype(std::nexttowardl(0, (long double)0)), long double>::value), "");
   1145     assert(std::nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
   1146 }
   1147 
   1148 void test_remainder()
   1149 {
   1150     static_assert((std::is_same<decltype(std::remainder((float)0, (float)0)), float>::value), "");
   1151     static_assert((std::is_same<decltype(std::remainder((bool)0, (float)0)), double>::value), "");
   1152     static_assert((std::is_same<decltype(std::remainder((unsigned short)0, (double)0)), double>::value), "");
   1153     static_assert((std::is_same<decltype(std::remainder((int)0, (long double)0)), long double>::value), "");
   1154     static_assert((std::is_same<decltype(std::remainder((float)0, (unsigned int)0)), double>::value), "");
   1155     static_assert((std::is_same<decltype(std::remainder((double)0, (long)0)), double>::value), "");
   1156     static_assert((std::is_same<decltype(std::remainder((long double)0, (unsigned long)0)), long double>::value), "");
   1157     static_assert((std::is_same<decltype(std::remainder((int)0, (long long)0)), double>::value), "");
   1158     static_assert((std::is_same<decltype(std::remainder((int)0, (unsigned long long)0)), double>::value), "");
   1159     static_assert((std::is_same<decltype(std::remainder((double)0, (double)0)), double>::value), "");
   1160     static_assert((std::is_same<decltype(std::remainder((long double)0, (long double)0)), long double>::value), "");
   1161     static_assert((std::is_same<decltype(std::remainder((float)0, (double)0)), double>::value), "");
   1162     static_assert((std::is_same<decltype(std::remainder((float)0, (long double)0)), long double>::value), "");
   1163     static_assert((std::is_same<decltype(std::remainder((double)0, (long double)0)), long double>::value), "");
   1164     static_assert((std::is_same<decltype(std::remainderf(0,0)), float>::value), "");
   1165     static_assert((std::is_same<decltype(std::remainderl(0,0)), long double>::value), "");
   1166     static_assert((std::is_same<decltype(std::remainder((int)0, (int)0)), double>::value), "");
   1167     assert(std::remainder(0.5,1) == 0.5);
   1168 }
   1169 
   1170 void test_remquo()
   1171 {
   1172     int ip;
   1173     static_assert((std::is_same<decltype(std::remquo((float)0, (float)0, &ip)), float>::value), "");
   1174     static_assert((std::is_same<decltype(std::remquo((bool)0, (float)0, &ip)), double>::value), "");
   1175     static_assert((std::is_same<decltype(std::remquo((unsigned short)0, (double)0, &ip)), double>::value), "");
   1176     static_assert((std::is_same<decltype(std::remquo((int)0, (long double)0, &ip)), long double>::value), "");
   1177     static_assert((std::is_same<decltype(std::remquo((float)0, (unsigned int)0, &ip)), double>::value), "");
   1178     static_assert((std::is_same<decltype(std::remquo((double)0, (long)0, &ip)), double>::value), "");
   1179     static_assert((std::is_same<decltype(std::remquo((long double)0, (unsigned long)0, &ip)), long double>::value), "");
   1180     static_assert((std::is_same<decltype(std::remquo((int)0, (long long)0, &ip)), double>::value), "");
   1181     static_assert((std::is_same<decltype(std::remquo((int)0, (unsigned long long)0, &ip)), double>::value), "");
   1182     static_assert((std::is_same<decltype(std::remquo((double)0, (double)0, &ip)), double>::value), "");
   1183     static_assert((std::is_same<decltype(std::remquo((long double)0, (long double)0, &ip)), long double>::value), "");
   1184     static_assert((std::is_same<decltype(std::remquo((float)0, (double)0, &ip)), double>::value), "");
   1185     static_assert((std::is_same<decltype(std::remquo((float)0, (long double)0, &ip)), long double>::value), "");
   1186     static_assert((std::is_same<decltype(std::remquo((double)0, (long double)0, &ip)), long double>::value), "");
   1187     static_assert((std::is_same<decltype(std::remquof(0,0, &ip)), float>::value), "");
   1188     static_assert((std::is_same<decltype(std::remquol(0,0, &ip)), long double>::value), "");
   1189     static_assert((std::is_same<decltype(std::remquo((int)0, (int)0, &ip)), double>::value), "");
   1190     assert(std::remquo(0.5,1, &ip) == 0.5);
   1191 }
   1192 
   1193 void test_rint()
   1194 {
   1195     static_assert((std::is_same<decltype(std::rint((float)0)), float>::value), "");
   1196     static_assert((std::is_same<decltype(std::rint((bool)0)), double>::value), "");
   1197     static_assert((std::is_same<decltype(std::rint((unsigned short)0)), double>::value), "");
   1198     static_assert((std::is_same<decltype(std::rint((int)0)), double>::value), "");
   1199     static_assert((std::is_same<decltype(std::rint((unsigned int)0)), double>::value), "");
   1200     static_assert((std::is_same<decltype(std::rint((long)0)), double>::value), "");
   1201     static_assert((std::is_same<decltype(std::rint((unsigned long)0)), double>::value), "");
   1202     static_assert((std::is_same<decltype(std::rint((long long)0)), double>::value), "");
   1203     static_assert((std::is_same<decltype(std::rint((unsigned long long)0)), double>::value), "");
   1204     static_assert((std::is_same<decltype(std::rint((double)0)), double>::value), "");
   1205     static_assert((std::is_same<decltype(std::rint((long double)0)), long double>::value), "");
   1206     static_assert((std::is_same<decltype(std::rintf(0)), float>::value), "");
   1207     static_assert((std::is_same<decltype(std::rintl(0)), long double>::value), "");
   1208     assert(std::rint(1) == 1);
   1209 }
   1210 
   1211 void test_round()
   1212 {
   1213     static_assert((std::is_same<decltype(std::round((float)0)), float>::value), "");
   1214     static_assert((std::is_same<decltype(std::round((bool)0)), double>::value), "");
   1215     static_assert((std::is_same<decltype(std::round((unsigned short)0)), double>::value), "");
   1216     static_assert((std::is_same<decltype(std::round((int)0)), double>::value), "");
   1217     static_assert((std::is_same<decltype(std::round((unsigned int)0)), double>::value), "");
   1218     static_assert((std::is_same<decltype(std::round((long)0)), double>::value), "");
   1219     static_assert((std::is_same<decltype(std::round((unsigned long)0)), double>::value), "");
   1220     static_assert((std::is_same<decltype(std::round((long long)0)), double>::value), "");
   1221     static_assert((std::is_same<decltype(std::round((unsigned long long)0)), double>::value), "");
   1222     static_assert((std::is_same<decltype(std::round((double)0)), double>::value), "");
   1223     static_assert((std::is_same<decltype(std::round((long double)0)), long double>::value), "");
   1224     static_assert((std::is_same<decltype(std::roundf(0)), float>::value), "");
   1225     static_assert((std::is_same<decltype(std::roundl(0)), long double>::value), "");
   1226     assert(std::round(1) == 1);
   1227 }
   1228 
   1229 void test_scalbln()
   1230 {
   1231     static_assert((std::is_same<decltype(std::scalbln((float)0, (long)0)), float>::value), "");
   1232     static_assert((std::is_same<decltype(std::scalbln((bool)0, (long)0)), double>::value), "");
   1233     static_assert((std::is_same<decltype(std::scalbln((unsigned short)0, (long)0)), double>::value), "");
   1234     static_assert((std::is_same<decltype(std::scalbln((int)0, (long)0)), double>::value), "");
   1235     static_assert((std::is_same<decltype(std::scalbln((unsigned int)0, (long)0)), double>::value), "");
   1236     static_assert((std::is_same<decltype(std::scalbln((long)0, (long)0)), double>::value), "");
   1237     static_assert((std::is_same<decltype(std::scalbln((unsigned long)0, (long)0)), double>::value), "");
   1238     static_assert((std::is_same<decltype(std::scalbln((long long)0, (long)0)), double>::value), "");
   1239     static_assert((std::is_same<decltype(std::scalbln((unsigned long long)0, (long)0)), double>::value), "");
   1240     static_assert((std::is_same<decltype(std::scalbln((double)0, (long)0)), double>::value), "");
   1241     static_assert((std::is_same<decltype(std::scalbln((long double)0, (long)0)), long double>::value), "");
   1242     static_assert((std::is_same<decltype(std::scalblnf(0, (long)0)), float>::value), "");
   1243     static_assert((std::is_same<decltype(std::scalblnl(0, (long)0)), long double>::value), "");
   1244     assert(std::scalbln(1, 1) == 2);
   1245 }
   1246 
   1247 void test_scalbn()
   1248 {
   1249     static_assert((std::is_same<decltype(std::scalbn((float)0, (int)0)), float>::value), "");
   1250     static_assert((std::is_same<decltype(std::scalbn((bool)0, (int)0)), double>::value), "");
   1251     static_assert((std::is_same<decltype(std::scalbn((unsigned short)0, (int)0)), double>::value), "");
   1252     static_assert((std::is_same<decltype(std::scalbn((int)0, (int)0)), double>::value), "");
   1253     static_assert((std::is_same<decltype(std::scalbn((unsigned int)0, (int)0)), double>::value), "");
   1254     static_assert((std::is_same<decltype(std::scalbn((long)0, (int)0)), double>::value), "");
   1255     static_assert((std::is_same<decltype(std::scalbn((unsigned long)0, (int)0)), double>::value), "");
   1256     static_assert((std::is_same<decltype(std::scalbn((long long)0, (int)0)), double>::value), "");
   1257     static_assert((std::is_same<decltype(std::scalbn((unsigned long long)0, (int)0)), double>::value), "");
   1258     static_assert((std::is_same<decltype(std::scalbn((double)0, (int)0)), double>::value), "");
   1259     static_assert((std::is_same<decltype(std::scalbn((long double)0, (int)0)), long double>::value), "");
   1260     static_assert((std::is_same<decltype(std::scalbnf(0, (int)0)), float>::value), "");
   1261     static_assert((std::is_same<decltype(std::scalbnl(0, (int)0)), long double>::value), "");
   1262     assert(std::scalbn(1, 1) == 2);
   1263 }
   1264 
   1265 void test_tgamma()
   1266 {
   1267     static_assert((std::is_same<decltype(std::tgamma((float)0)), float>::value), "");
   1268     static_assert((std::is_same<decltype(std::tgamma((bool)0)), double>::value), "");
   1269     static_assert((std::is_same<decltype(std::tgamma((unsigned short)0)), double>::value), "");
   1270     static_assert((std::is_same<decltype(std::tgamma((int)0)), double>::value), "");
   1271     static_assert((std::is_same<decltype(std::tgamma((unsigned int)0)), double>::value), "");
   1272     static_assert((std::is_same<decltype(std::tgamma((long)0)), double>::value), "");
   1273     static_assert((std::is_same<decltype(std::tgamma((unsigned long)0)), double>::value), "");
   1274     static_assert((std::is_same<decltype(std::tgamma((long long)0)), double>::value), "");
   1275     static_assert((std::is_same<decltype(std::tgamma((unsigned long long)0)), double>::value), "");
   1276     static_assert((std::is_same<decltype(std::tgamma((double)0)), double>::value), "");
   1277     static_assert((std::is_same<decltype(std::tgamma((long double)0)), long double>::value), "");
   1278     static_assert((std::is_same<decltype(std::tgammaf(0)), float>::value), "");
   1279     static_assert((std::is_same<decltype(std::tgammal(0)), long double>::value), "");
   1280     assert(std::tgamma(1) == 1);
   1281 }
   1282 
   1283 void test_trunc()
   1284 {
   1285     static_assert((std::is_same<decltype(std::trunc((float)0)), float>::value), "");
   1286     static_assert((std::is_same<decltype(std::trunc((bool)0)), double>::value), "");
   1287     static_assert((std::is_same<decltype(std::trunc((unsigned short)0)), double>::value), "");
   1288     static_assert((std::is_same<decltype(std::trunc((int)0)), double>::value), "");
   1289     static_assert((std::is_same<decltype(std::trunc((unsigned int)0)), double>::value), "");
   1290     static_assert((std::is_same<decltype(std::trunc((long)0)), double>::value), "");
   1291     static_assert((std::is_same<decltype(std::trunc((unsigned long)0)), double>::value), "");
   1292     static_assert((std::is_same<decltype(std::trunc((long long)0)), double>::value), "");
   1293     static_assert((std::is_same<decltype(std::trunc((unsigned long long)0)), double>::value), "");
   1294     static_assert((std::is_same<decltype(std::trunc((double)0)), double>::value), "");
   1295     static_assert((std::is_same<decltype(std::trunc((long double)0)), long double>::value), "");
   1296     static_assert((std::is_same<decltype(std::truncf(0)), float>::value), "");
   1297     static_assert((std::is_same<decltype(std::truncl(0)), long double>::value), "");
   1298     assert(std::trunc(1) == 1);
   1299 }
   1300 
   1301 int main()
   1302 {
   1303     test_abs();
   1304     test_acos();
   1305     test_asin();
   1306     test_atan();
   1307     test_atan2();
   1308     test_ceil();
   1309     test_cos();
   1310     test_cosh();
   1311     test_exp();
   1312     test_fabs();
   1313     test_floor();
   1314     test_fmod();
   1315     test_frexp();
   1316     test_ldexp();
   1317     test_log();
   1318     test_log10();
   1319     test_modf();
   1320     test_pow();
   1321     test_sin();
   1322     test_sinh();
   1323     test_sqrt();
   1324     test_tan();
   1325     test_tanh();
   1326     test_signbit();
   1327     test_fpclassify();
   1328     test_isfinite();
   1329     test_isinf();
   1330     test_isnan();
   1331     test_isnormal();
   1332     test_isgreater();
   1333     test_isgreaterequal();
   1334     test_isless();
   1335     test_islessequal();
   1336     test_islessgreater();
   1337     test_isunordered();
   1338     test_acosh();
   1339     test_asinh();
   1340     test_atanh();
   1341     test_cbrt();
   1342     test_copysign();
   1343     test_erf();
   1344     test_erfc();
   1345     test_exp2();
   1346     test_expm1();
   1347     test_fdim();
   1348     test_fma();
   1349     test_fmax();
   1350     test_fmin();
   1351     test_hypot();
   1352     test_ilogb();
   1353     test_lgamma();
   1354     test_llrint();
   1355     test_llround();
   1356     test_log1p();
   1357     test_log2();
   1358     test_logb();
   1359     test_lrint();
   1360     test_lround();
   1361     test_nan();
   1362     test_nearbyint();
   1363     test_nextafter();
   1364     test_nexttoward();
   1365     test_remainder();
   1366     test_remquo();
   1367     test_rint();
   1368     test_round();
   1369     test_scalbln();
   1370     test_scalbn();
   1371     test_tgamma();
   1372     test_trunc();
   1373 }
   1374