15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier
95a83710eSEric Fiselier // <valarray>
105a83710eSEric Fiselier
115a83710eSEric Fiselier // template<class T> class valarray;
125a83710eSEric Fiselier
135a83710eSEric Fiselier // template<class T>
145a83710eSEric Fiselier // valarray<T>
155a83710eSEric Fiselier // atan2(const T& x, const valarray<T>& y);
165a83710eSEric Fiselier
175a83710eSEric Fiselier #include <valarray>
185a83710eSEric Fiselier #include <cassert>
19e898b484SStephan T. Lavavej #include <cstddef>
205a83710eSEric Fiselier
217fc6a556SMarshall Clow #include "test_macros.h"
22*9339ab30SLouis Dionne #include "valarray_helper.h"
235a83710eSEric Fiselier
main(int,char **)242df59c50SJF Bastien int main(int, char**)
255a83710eSEric Fiselier {
265a83710eSEric Fiselier {
275a83710eSEric Fiselier typedef double T;
285a83710eSEric Fiselier T a1[] = {-.9, -.5, 0., .5, .75};
295a83710eSEric Fiselier T a3[] = {2.4468543773930902e+00,
305a83710eSEric Fiselier 2.1587989303424640e+00,
315a83710eSEric Fiselier 1.5707963267948966e+00,
325a83710eSEric Fiselier 9.8279372324732905e-01,
335a83710eSEric Fiselier 7.8539816339744828e-01};
345a83710eSEric Fiselier const unsigned N = sizeof(a1)/sizeof(a1[0]);
355a83710eSEric Fiselier std::valarray<T> v1(a1, N);
365a83710eSEric Fiselier std::valarray<T> v3 = atan2(.75, v1);
375a83710eSEric Fiselier assert(v3.size() == v1.size());
38e898b484SStephan T. Lavavej for (std::size_t i = 0; i < v3.size(); ++i)
395a83710eSEric Fiselier assert(is_about(v3[i], a3[i], 10));
405a83710eSEric Fiselier }
412df59c50SJF Bastien
422df59c50SJF Bastien return 0;
435a83710eSEric Fiselier }
44