1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // abs(const complex<T>& x);
18 #include "test_macros.h"
25 std::complex<T
> z(3, 4);
31 const unsigned N
= sizeof(testcases
) / sizeof(testcases
[0]);
32 for (unsigned i
= 0; i
< N
; ++i
)
34 double r
= abs(testcases
[i
]);
35 switch (classify(testcases
[i
]))
39 assert(!std::signbit(r
));
42 assert(std::isfinite(r
) && r
> 0);
45 assert(std::isinf(r
) && r
> 0);
48 assert(std::isnan(r
));
51 assert(std::isnan(r
));