This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
errnoSection: 29.10.8.13 [simd.math], 29.10.8.15 [simd.complex.math] Status: New Submitter: Jan Schultke Opened: 2026-11-10 Last modified: 2026-11-15
Priority: Not Prioritized
View all issues with New status.
Discussion:
Throughout subclause 29.10 [simd], it is stated that access to errno is unspecified.
This allows otherwise non-compliant optimizations like -fno-math-errno.
errno for no good reason,
even when the underlying math function would have never done so. For example,
std::sqrt(0) does not access errno, but it is unspecified whether
std::simd::sqrt(std::simd::vec<double>(0)) accesses errno.
Proposed resolution:
This wording is relative to N5054.
Modify 29.10.8.13 [simd.math] as indicated:
template<math-floating-point V> constexpr rebind_t<int, deduced-vec-t<V>> ilogb(const V& x); […] template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isunordered(const V& x, const deduced-vec-t<V>& y);-1- Let
-2- Returns: A valueRetdenote the return type of the specialization of a function template […]retof typeRet, that is element-wise equal to the result of callingmath-func-vecwith the parameters of the above functions. If in an invocation of a scalar overload ofmath-funcfor indexiinmath-func-veca domain, pole, or range error would occur, the value ofret[i]is unspecified. -3 Remarks: It is unspecified whethererrno(19.4 [errno]) is accessed if a domain, pole, or range error would occur.template<math-floating-point V> constexpr deduced-vec-t<V> ldexp(const V& x, const rebind_t<int, deduced-vec-t<V>>& exp); […] template<math-floating-point V> constexpr deduced-vec-t<V> scalbln(const V& x, const rebind_t<long int, deduced-vec-t<V>>& n);[…]-4- Let
-5- Returns: A valueRetbededuced-vec-t<V>. Letmath-funcdenote the name of the function template. Letmath-func-vecdenote: […]retof typeRet, that is element-wise equal to the result of callingmath-func-vecwith the parameters of the above functions. If in an invocation of a scalar overload ofmath-funcfor indexiinmath-func-veca domain, pole, or range error would occur, the value ofret[i]is unspecified. -6- Remarks: It is unspecified whethererrno(19.4 [errno]) is accessed if a domain, pole, or range error would occur.template<math-floating-point V> constexpr deduced-vec-t<V> acos(const V& x); […] template<math-floating-point V> deduced-vec-t<V> riemann_zeta(const V& x);[…]-9- Let
-10- Returns: A valueRetdenote the return type of the specialization of a function template with the namemath-func. Letmath-func-vecdenote: […]retof typeRet, that is element-wise approximately equal to the result of callingmath-func-vecwith the parameters of the above functions. If in an invocation of a scalar overload ofmath-funcfor indexiinmath-func-veca domain, pole, or range error would occur, the value ofret[i]is unspecified. -11- Remarks: It is unspecified whethererrno(19.4 [errno]) is accessed if a domain, pole, or range error would occur.template<math-floating-point V> constexpr deduced-vec-t<V> remquo(const V& x, const V& y, rebind_t<int, deduced-vec-t<V>>* quo); […] template<math-floating-point V> constexpr deduced-vec-t<V> remquo(const V& x, const deduced-vec-t<V>& y, rebind_t<int, deduced-vec-t<V>>* quo);-19- Let
-20- Effects: SetsV0bededuced-vec-t<V>. Letremquo-vecdenote: […] If in an invocation of a scalar overload ofremquofor indexiinremquo-veca domain, pole, or range error would occur, the value ofret[i]is unspecified.*quotoret.second. -21- Returns:ret.first. -22- Remarks: It is unspecified whethererrno(19.4 [errno]) is accessed if a domain, pole, or range error would occur.
Modify 29.10.8.15 [simd.complex.math] as indicated:
template<simd-complex V> constexpr rebind_t<simd-complex-value-type<V> , V> real(const V&) noexcept; […] template<simd-complex V> constexpr V atanh(const V& v);-1- Returns: A
-2- Remarks: It is unspecified whetherbasic_vecobjectretwhere […]. If in an invocation ofcmplx-funcfor indexia domain, pole, or range error would occur, the value ofret[i]is unspecified.errno(19.4 [errno]) is accessed if a domain, pole, or range error would occur.template<simd-floating-point V> rebind_t<complex<typename V::value_type>, V> polar(const V& x, const V& y = {}); template<simd-complex V> constexpr V pow(const V& x, const V& y);-3- Returns: A
-4- Remarks: It is unspecified whetherbasic_vecobjectretwhere […]. If in an invocation ofcmplx-funcfor indexia domain, pole, or range error would occur, the value ofret[i]is unspecified.errno(19.4 [errno]) is accessed if a domain, pole, or range error would occur.