[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / language.support / support.limits / limits / numeric.limits.members / infinity.pass.cpp
blob93c6765e5c044a5dbd53aafe053aa98ea4afa823
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // test numeric_limits
11 // infinity()
13 #include <limits>
14 #include <cfloat>
15 #include <cassert>
17 #include "test_macros.h"
19 template <class T>
20 void
21 test(T expected)
23 assert(std::numeric_limits<T>::infinity() == expected);
24 assert(std::numeric_limits<const T>::infinity() == expected);
25 assert(std::numeric_limits<volatile T>::infinity() == expected);
26 assert(std::numeric_limits<const volatile T>::infinity() == expected);
29 extern float zero;
31 int main(int, char**)
33 test<bool>(false);
34 test<char>(0);
35 test<signed char>(0);
36 test<unsigned char>(0);
37 test<wchar_t>(0);
38 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
39 test<char8_t>(0);
40 #endif
41 test<char16_t>(0);
42 test<char32_t>(0);
43 test<short>(0);
44 test<unsigned short>(0);
45 test<int>(0);
46 test<unsigned int>(0);
47 test<long>(0);
48 test<unsigned long>(0);
49 test<long long>(0);
50 test<unsigned long long>(0);
51 #ifndef TEST_HAS_NO_INT128
52 test<__int128_t>(0);
53 test<__uint128_t>(0);
54 #endif
55 test<float>(1.f/zero);
56 test<double>(1./zero);
57 test<long double>(1./zero);
59 return 0;
62 float zero = 0;