//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // test numeric_limits // infinity() #include #include #include #include "test_macros.h" template void test(T expected) { assert(std::numeric_limits::infinity() == expected); assert(std::numeric_limits::infinity() == expected); assert(std::numeric_limits::infinity() == expected); assert(std::numeric_limits::infinity() == expected); } extern float zero; int main(int, char**) { test(false); test(0); test(0); test(0); test(0); #if TEST_STD_VER > 17 && defined(__cpp_char8_t) test(0); #endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS test(0); test(0); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS test(0); test(0); test(0); test(0); test(0); test(0); test(0); test(0); #ifndef _LIBCPP_HAS_NO_INT128 test<__int128_t>(0); test<__uint128_t>(0); #endif test(1.f/zero); test(1./zero); test(1./zero); return 0; } float zero = 0;