Index: include/valarray =================================================================== --- include/valarray +++ include/valarray @@ -4472,6 +4472,15 @@ return __val_expr<_Op>(_Op(__abs_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__abs_expr<_Tp>, valarray<_Tp> > > +abs(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__abs_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__abs_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4486,6 +4495,15 @@ return __val_expr<_Op>(_Op(__acos_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__acos_expr<_Tp>, valarray<_Tp> > > +acos(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__acos_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__acos_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4500,6 +4518,15 @@ return __val_expr<_Op>(_Op(__asin_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__asin_expr<_Tp>, valarray<_Tp> > > +asin(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__asin_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__asin_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4514,6 +4541,15 @@ return __val_expr<_Op>(_Op(__atan_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__atan_expr<_Tp>, valarray<_Tp> > > +atan(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__atan_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__atan_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4528,6 +4564,15 @@ return __val_expr<_Op>(_Op(__atan2_expr(), __x, __y)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_BinaryOp<__atan2_expr<_Tp>, valarray<_Tp>, valarray<_Tp> > > +atan2(const valarray<_Tp>& __x, const valarray<_Tp>& __y) +{ + typedef _BinaryOp<__atan2_expr<_Tp>, valarray<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__atan2_expr<_Tp>(), __x, __y)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4544,6 +4589,16 @@ __x, __scalar_expr(__y, __x.size()))); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_BinaryOp<__atan2_expr<_Tp>, valarray<_Tp>, __scalar_expr<_Tp> > > +atan2(const valarray<_Tp>& __x, const _Tp& __y) +{ + typedef _BinaryOp<__atan2_expr<_Tp>, valarray<_Tp>, __scalar_expr<_Tp> > _Op; + return __val_expr<_Op>(_Op(__atan2_expr<_Tp>(), + __x, __scalar_expr<_Tp>(__y, __x.size()))); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4560,6 +4615,16 @@ __scalar_expr(__x, __y.size()), __y)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_BinaryOp<__atan2_expr<_Tp>, __scalar_expr<_Tp>, valarray<_Tp> > > +atan2(const _Tp& __x, const valarray<_Tp>& __y) +{ + typedef _BinaryOp<__atan2_expr<_Tp>, __scalar_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__atan2_expr<_Tp>(), + __scalar_expr<_Tp>(__x, __y.size()), __y)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4574,6 +4639,15 @@ return __val_expr<_Op>(_Op(__cos_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__cos_expr<_Tp>, valarray<_Tp> > > +cos(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__cos_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__cos_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4588,6 +4662,15 @@ return __val_expr<_Op>(_Op(__cosh_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__cosh_expr<_Tp>, valarray<_Tp> > > +cosh(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__cosh_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__cosh_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4602,6 +4685,15 @@ return __val_expr<_Op>(_Op(__exp_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__exp_expr<_Tp>, valarray<_Tp> > > +exp(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__exp_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__exp_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4616,6 +4708,15 @@ return __val_expr<_Op>(_Op(__log_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__log_expr<_Tp>, valarray<_Tp> > > +log(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__log_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__log_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4630,6 +4731,15 @@ return __val_expr<_Op>(_Op(__log10_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__log10_expr<_Tp>, valarray<_Tp> > > +log10(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__log10_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__log10_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4644,6 +4754,15 @@ return __val_expr<_Op>(_Op(__pow_expr(), __x, __y)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_BinaryOp<__pow_expr<_Tp>, valarray<_Tp>, valarray<_Tp> > > +pow(const valarray<_Tp>& __x, const valarray<_Tp>& __y) +{ + typedef _BinaryOp<__pow_expr<_Tp>, valarray<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__pow_expr<_Tp>(), __x, __y)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4660,6 +4779,17 @@ __x, __scalar_expr(__y, __x.size()))); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_BinaryOp<__pow_expr<_Tp>, + valarray<_Tp>, __scalar_expr<_Tp> > > +pow(const valarray<_Tp>& __x, const _Tp& __y) +{ + typedef _BinaryOp<__pow_expr<_Tp>, valarray<_Tp>, __scalar_expr<_Tp> > _Op; + return __val_expr<_Op>(_Op(__pow_expr<_Tp>(), + __x, __scalar_expr<_Tp>(__y, __x.size()))); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4676,6 +4806,17 @@ __scalar_expr(__x, __y.size()), __y)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_BinaryOp<__pow_expr<_Tp>, + __scalar_expr<_Tp>, valarray<_Tp> > > +pow(const _Tp& __x, const valarray<_Tp>& __y) +{ + typedef _BinaryOp<__pow_expr<_Tp>, __scalar_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__pow_expr<_Tp>(), + __scalar_expr<_Tp>(__x, __y.size()), __y)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4690,6 +4831,15 @@ return __val_expr<_Op>(_Op(__sin_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__sin_expr<_Tp>, valarray<_Tp> > > +sin(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__sin_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__sin_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4704,6 +4854,15 @@ return __val_expr<_Op>(_Op(__sinh_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__sinh_expr<_Tp>, valarray<_Tp> > > +sinh(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__sinh_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__sinh_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4718,6 +4877,15 @@ return __val_expr<_Op>(_Op(__sqrt_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__sqrt_expr<_Tp>, valarray<_Tp> > > +sqrt(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__sqrt_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__sqrt_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4732,6 +4900,15 @@ return __val_expr<_Op>(_Op(__tan_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__tan_expr<_Tp>, valarray<_Tp> > > +tan(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__tan_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__tan_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -4746,6 +4923,15 @@ return __val_expr<_Op>(_Op(__tanh_expr(), __x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +__val_expr<_UnaryOp<__tanh_expr<_Tp>, valarray<_Tp> > > +tanh(const valarray<_Tp>& __x) +{ + typedef _UnaryOp<__tanh_expr<_Tp>, valarray<_Tp> > _Op; + return __val_expr<_Op>(_Op(__tanh_expr<_Tp>(), __x)); +} + template inline _LIBCPP_INLINE_VISIBILITY _Tp* Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp @@ -20,15 +20,22 @@ int main() { + typedef double T; + T a1[] = {1.5, -2.5, 3.4, -4.5, -5.0}; + T a3[] = {1.5, 2.5, 3.4, 4.5, 5.0}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {1.5, -2.5, 3.4, -4.5, -5.0}; - T a3[] = {1.5, 2.5, 3.4, 4.5, 5.0}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = abs(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(v3[i] == a3[i]); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::abs(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {2.6905658417935308e+00, + 2.0943951023931957e+00, + 1.5707963267948966e+00, + 1.0471975511965976e+00, + 7.2273424781341566e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {2.6905658417935308e+00, - 2.0943951023931957e+00, - 1.5707963267948966e+00, - 1.0471975511965976e+00, - 7.2273424781341566e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = acos(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::acos(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-1.1197695149986342e+00, + -5.2359877559829882e-01, + 0.0000000000000000e+00, + 5.2359877559829882e-01, + 8.4806207898148100e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-1.1197695149986342e+00, - -5.2359877559829882e-01, - 0.0000000000000000e+00, - 5.2359877559829882e-01, - 8.4806207898148100e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = asin(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::asin(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp @@ -33,16 +33,16 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a2[] = {-.8, .25, 0.375, -.5, .75}; + T a3[] = {-2.2974386674766221e+00, + -1.1071487177940904e+00, + 0.0000000000000000e+00, + 2.3561944901923448e+00, + 7.8539816339744828e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a2[] = {-.8, .25, 0.375, -.5, .75}; - T a3[] = {-2.2974386674766221e+00, - -1.1071487177940904e+00, - 0.0000000000000000e+00, - 2.3561944901923448e+00, - 7.8539816339744828e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v2(a2, N); std::valarray v3 = atan2(v1, v2); @@ -50,4 +50,12 @@ for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v2(a2, N); + std::valarray v3 = std::atan2(v1, v2); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-8.7605805059819342e-01, + -5.8800260354756750e-01, + 0.0000000000000000e+00, + 5.8800260354756750e-01, + 7.8539816339744828e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-8.7605805059819342e-01, - -5.8800260354756750e-01, - 0.0000000000000000e+00, - 5.8800260354756750e-01, - 7.8539816339744828e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = atan2(v1, .75); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::atan2(v1, .75); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {2.4468543773930902e+00, + 2.1587989303424640e+00, + 1.5707963267948966e+00, + 9.8279372324732905e-01, + 7.8539816339744828e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {2.4468543773930902e+00, - 2.1587989303424640e+00, - 1.5707963267948966e+00, - 9.8279372324732905e-01, - 7.8539816339744828e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = atan2(.75, v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::atan2(.75, v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-7.3281510178650666e-01, + -4.6364760900080615e-01, + 0.0000000000000000e+00, + 4.6364760900080615e-01, + 6.4350110879328437e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-7.3281510178650666e-01, - -4.6364760900080615e-01, - 0.0000000000000000e+00, - 4.6364760900080615e-01, - 6.4350110879328437e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = atan(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::atan(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {6.2160996827066450e-01, + 8.7758256189037276e-01, + 1.0000000000000000e+00, + 8.7758256189037276e-01, + 7.3168886887382090e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {6.2160996827066450e-01, - 8.7758256189037276e-01, - 1.0000000000000000e+00, - 8.7758256189037276e-01, - 7.3168886887382090e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = cos(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::cos(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {1.4330863854487743e+00, + 1.1276259652063807e+00, + 1.0000000000000000e+00, + 1.1276259652063807e+00, + 1.2946832846768448e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {1.4330863854487743e+00, - 1.1276259652063807e+00, - 1.0000000000000000e+00, - 1.1276259652063807e+00, - 1.2946832846768448e+00}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = cosh(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::cosh(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {4.0656965974059911e-01, + 6.0653065971263342e-01, + 1.0000000000000000e+00, + 1.6487212707001282e+00, + 2.1170000166126748e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {4.0656965974059911e-01, - 6.0653065971263342e-01, - 1.0000000000000000e+00, - 1.6487212707001282e+00, - 2.1170000166126748e+00}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = exp(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::exp(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {.5, .75, 1, 3, 7}; + T a3[] = {-3.0102999566398120e-01, + -1.2493873660829995e-01, + 0.0000000000000000e+00, + 4.7712125471966244e-01, + 8.4509804001425681e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {.5, .75, 1, 3, 7}; - T a3[] = {-3.0102999566398120e-01, - -1.2493873660829995e-01, - 0.0000000000000000e+00, - 4.7712125471966244e-01, - 8.4509804001425681e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = log10(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::log10(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {.5, .75, 1, 3, 7}; + T a3[] = {-6.9314718055994529e-01, + -2.8768207245178090e-01, + 0.0000000000000000e+00, + 1.0986122886681098e+00, + 1.9459101490553132e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {.5, .75, 1, 3, 7}; - T a3[] = {-6.9314718055994529e-01, - -2.8768207245178090e-01, - 0.0000000000000000e+00, - 1.0986122886681098e+00, - 1.9459101490553132e+00}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = log(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::log(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp @@ -33,16 +33,16 @@ int main() { + typedef double T; + T a1[] = {.9, .5, 0., .5, .75}; + T a2[] = {-.8, .25, 0.375, -.5, .75}; + T a3[] = {1.0879426248455297e+00, + 8.4089641525371450e-01, + 0.0000000000000000e+00, + 1.4142135623730949e+00, + 8.0592744886765644e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {.9, .5, 0., .5, .75}; - T a2[] = {-.8, .25, 0.375, -.5, .75}; - T a3[] = {1.0879426248455297e+00, - 8.4089641525371450e-01, - 0.0000000000000000e+00, - 1.4142135623730949e+00, - 8.0592744886765644e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v2(a2, N); std::valarray v3 = pow(v1, v2); @@ -50,4 +50,12 @@ for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v2(a2, N); + std::valarray v3 = std::pow(v1, v2); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {.9, .5, 0., .5, .75}; + T a3[] = {8.1000000000000005e-01, + 2.5000000000000000e-01, + 0.0000000000000000e+00, + 2.5000000000000000e-01, + 5.6250000000000000e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {.9, .5, 0., .5, .75}; - T a3[] = {8.1000000000000005e-01, - 2.5000000000000000e-01, - 0.0000000000000000e+00, - 2.5000000000000000e-01, - 5.6250000000000000e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = pow(v1, 2.0); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::pow(v1, 2.0); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {.9, .5, 0., .5, .75}; + T a3[] = {1.8660659830736148e+00, + 1.4142135623730951e+00, + 1.0000000000000000e+00, + 1.4142135623730951e+00, + 1.6817928305074290e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {.9, .5, 0., .5, .75}; - T a3[] = {1.8660659830736148e+00, - 1.4142135623730951e+00, - 1.0000000000000000e+00, - 1.4142135623730951e+00, - 1.6817928305074290e+00}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = pow(2.0, v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::pow(2.0, v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-7.8332690962748330e-01, + -4.7942553860420301e-01, + 0.0000000000000000e+00, + 4.7942553860420301e-01, + 6.8163876002333423e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-7.8332690962748330e-01, - -4.7942553860420301e-01, - 0.0000000000000000e+00, - 4.7942553860420301e-01, - 6.8163876002333423e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = sin(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::sin(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-1.0265167257081753e+00, + -5.2109530549374738e-01, + 0.0000000000000000e+00, + 5.2109530549374738e-01, + 8.2231673193582999e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-1.0265167257081753e+00, - -5.2109530549374738e-01, - 0.0000000000000000e+00, - 5.2109530549374738e-01, - 8.2231673193582999e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = sinh(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::sinh(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {.5, .75, 1, 3, 7}; + T a3[] = {7.0710678118654757e-01, + 8.6602540378443860e-01, + 1.0000000000000000e+00, + 1.7320508075688772e+00, + 2.6457513110645907e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {.5, .75, 1, 3, 7}; - T a3[] = {7.0710678118654757e-01, - 8.6602540378443860e-01, - 1.0000000000000000e+00, - 1.7320508075688772e+00, - 2.6457513110645907e+00}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = sqrt(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::sqrt(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-1.2601582175503390e+00, + -5.4630248984379048e-01, + 0.0000000000000000e+00, + 5.4630248984379048e-01, + 9.3159645994407259e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-1.2601582175503390e+00, - -5.4630248984379048e-01, - 0.0000000000000000e+00, - 5.4630248984379048e-01, - 9.3159645994407259e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = tan(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::tan(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } } Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp =================================================================== --- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp +++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp @@ -33,19 +33,26 @@ int main() { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-7.1629787019902447e-01, + -4.6211715726000974e-01, + 0.0000000000000000e+00, + 4.6211715726000974e-01, + 6.3514895238728730e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); { - typedef double T; - T a1[] = {-.9, -.5, 0., .5, .75}; - T a3[] = {-7.1629787019902447e-01, - -4.6211715726000974e-01, - 0.0000000000000000e+00, - 4.6211715726000974e-01, - 6.3514895238728730e-01}; - const unsigned N = sizeof(a1)/sizeof(a1[0]); std::valarray v1(a1, N); std::valarray v3 = tanh(v1); assert(v3.size() == v1.size()); for (int i = 0; i < v3.size(); ++i) assert(is_about(v3[i], a3[i], 10)); } + { + std::valarray v1(a1, N); + std::valarray v3 = std::tanh(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } }