//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // #include #include #include #include "hexfloat.h" void test_acos() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(acos(1) == 0); } void test_asin() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(asin(0) == 0); } void test_atan() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(atan(0) == 0); } void test_atan2() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(atan2(0,1) == 0); } void test_ceil() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(ceil(0) == 0); } void test_cos() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(cos(0) == 1); } void test_cosh() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(cosh(0) == 1); } void test_exp() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(exp(0) == 1); } void test_fabs() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fabs(-1) == 1); } void test_floor() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(floor(1) == 1); } void test_fmod() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fmod(1.5,1) == .5); } void test_frexp() { int ip; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(frexp(0, &ip) == 0); } void test_ldexp() { int ip = 1; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(ldexp(1, ip) == 2); } void test_log() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(log(1) == 0); } void test_log10() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(log10(1) == 0); } void test_modf() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); double i; assert(modf(1., &i) == 0); } void test_pow() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(pow(1,1) == 1); } void test_sin() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(sin(0) == 0); } void test_sinh() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(sinh(0) == 0); } void test_sqrt() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(sqrt(4) == 2); } void test_tan() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(tan(0) == 0); } void test_tanh() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(tanh(0) == 0); } void test_signbit() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(signbit(-1.0) == true); } void test_fpclassify() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fpclassify(-1.0) == FP_NORMAL); } void test_isfinite() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isfinite(-1.0) == true); } void test_isinf() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isinf(-1.0) == false); } void test_isnan() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isnan(-1.0) == false); } void test_isnormal() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isnormal(-1.0) == true); } void test_isgreater() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isgreater(-1.0, 0.F) == false); } void test_isgreaterequal() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isgreaterequal(-1.0, 0.F) == false); } void test_isless() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isless(-1.0, 0.F) == true); } void test_islessequal() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(islessequal(-1.0, 0.F) == true); } void test_islessgreater() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(islessgreater(-1.0, 0.F) == true); } void test_isunordered() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(isunordered(-1.0, 0.F) == false); } void test_acosh() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(acosh(1) == 0); } void test_asinh() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(asinh(0) == 0); } void test_atanh() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(atanh(0) == 0); } void test_cbrt() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(cbrt(1) == 1); } void test_copysign() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(copysign(1,1) == 1); } void test_erf() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(erf(0) == 0); } void test_erfc() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(erfc(0) == 1); } void test_exp2() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(exp2(1) == 2); } void test_expm1() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(expm1(0) == 0); } void test_fdim() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fdim(1,0) == 1); } void test_fma() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fma(1,1,1) == 2); } void test_fmax() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fmax(1,0) == 1); } void test_fmin() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(fmin(1,0) == 0); } void test_hypot() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(hypot(3,4) == 5); } void test_ilogb() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(ilogb(1) == 0); } void test_lgamma() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(lgamma(1) == 0); } void test_llrint() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(llrint(1) == 1LL); } void test_llround() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(llround(1) == 1LL); } void test_log1p() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(log1p(0) == 0); } void test_log2() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(log2(1) == 0); } void test_logb() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(logb(1) == 0); } void test_lrint() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(lrint(1) == 1L); } void test_lround() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(lround(1) == 1L); } void test_nan() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); } void test_nearbyint() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(nearbyint(1) == 1); } void test_nextafter() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(nextafter(0,1) == hexfloat(0x1, 0, -1074)); } void test_nexttoward() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(nexttoward(0, 1) == hexfloat(0x1, 0, -1074)); } void test_remainder() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(remainder(0.5,1) == 0.5); } void test_remquo() { int ip; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(remquo(0.5,1, &ip) == 0.5); } void test_rint() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(rint(1) == 1); } void test_round() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(round(1) == 1); } void test_scalbln() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(scalbln(1, 1) == 2); } void test_scalbn() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(scalbn(1, 1) == 2); } void test_tgamma() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(tgamma(1) == 1); } void test_trunc() { static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(trunc(1) == 1); } int main() { test_acos(); test_asin(); test_atan(); test_atan2(); test_ceil(); test_cos(); test_cosh(); test_exp(); test_fabs(); test_floor(); test_fmod(); test_frexp(); test_ldexp(); test_log(); test_log10(); test_modf(); test_pow(); test_sin(); test_sinh(); test_sqrt(); test_tan(); test_tanh(); test_signbit(); test_fpclassify(); test_isfinite(); test_isinf(); test_isnan(); test_isnormal(); test_isgreater(); test_isgreaterequal(); test_isless(); test_islessequal(); test_islessgreater(); test_isunordered(); test_acosh(); test_asinh(); test_atanh(); test_cbrt(); test_copysign(); test_erf(); test_erfc(); test_exp2(); test_expm1(); test_fdim(); test_fma(); test_fmax(); test_fmin(); test_hypot(); test_ilogb(); test_lgamma(); test_llrint(); test_llround(); test_log1p(); test_log2(); test_logb(); test_lrint(); test_lround(); test_nan(); test_nearbyint(); test_nextafter(); test_nexttoward(); test_remainder(); test_remquo(); test_rint(); test_round(); test_scalbln(); test_scalbn(); test_tgamma(); test_trunc(); }