// Copyright (C) 2020-2024 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// .
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
#include "bits/main.h"
template
void
test()
{
using T = typename V::value_type;
vir::test::setFuzzyness(1);
vir::test::setFuzzyness(1);
vir::test::setFuzzyness(1);
test_values_2arg(
{
#ifdef __STDC_IEC_559__
std::__quiet_NaN_v, std::__infinity_v, -std::__infinity_v, -0.,
std::__denorm_min_v, std::__norm_min_v / 3,
#endif
+0., std::__norm_min_v, 1., 2., std::__finite_max_v / 5,
std::__finite_max_v / 3, std::__finite_max_v / 2,
#ifdef __FAST_MATH__
// fast-math hypot is imprecise for the max exponent
},
{100000, std::__finite_max_v / 2},
#else
std::__finite_max_v},
{100000},
#endif
MAKE_TESTER(hypot));
#if !__FINITE_MATH_ONLY__
COMPARE(hypot(V(std::__finite_max_v), V(std::__finite_max_v)),
V(std::__infinity_v));
#endif
COMPARE(hypot(V(std::__norm_min_v), V(std::__norm_min_v)),
V(std::__norm_min_v * std::sqrt(T(2))));
VERIFY((sfinae_is_callable(
[](auto a, auto b) -> decltype(hypot(a, b)) { return {}; })));
VERIFY((sfinae_is_callable(
[](auto a, auto b) -> decltype(hypot(a, b)) { return {}; })));
VERIFY((sfinae_is_callable(
[](auto a, auto b) -> decltype(hypot(a, b)) { return {}; })));
vir::test::setFuzzyness(0);
vir::test::setFuzzyness(0);
vir::test::setFuzzyness(0);
test_values_2arg(
{
#ifdef __STDC_IEC_559__
std::__quiet_NaN_v, std::__infinity_v, -std::__infinity_v,
std::__denorm_min_v, std::__norm_min_v / 3, -0.,
#endif
+0., std::__norm_min_v, std::__finite_max_v},
{10000}, MAKE_TESTER(pow), MAKE_TESTER(fmod), MAKE_TESTER(remainder),
MAKE_TESTER_NOFPEXCEPT(copysign),
MAKE_TESTER(nextafter), // MAKE_TESTER(nexttoward),
MAKE_TESTER(fdim), MAKE_TESTER(fmax), MAKE_TESTER(fmin),
MAKE_TESTER_NOFPEXCEPT(isgreater), MAKE_TESTER_NOFPEXCEPT(isgreaterequal),
MAKE_TESTER_NOFPEXCEPT(isless), MAKE_TESTER_NOFPEXCEPT(islessequal),
MAKE_TESTER_NOFPEXCEPT(islessgreater), MAKE_TESTER_NOFPEXCEPT(isunordered));
}