From 9a116e91f720010a8154e529969b87c1322acb4d Mon Sep 17 00:00:00 2001 From: Juancho Date: Mon, 16 Nov 2026 18:29:41 +0000 Subject: [PATCH] [DQ.h] Fix operator-(Scalar, DQ), which returned dq - s instead of s - dq --- include/dqrobotics/DQ.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/dqrobotics/DQ.h b/include/dqrobotics/DQ.h index fc68b57..a7f7960 100644 --- a/include/dqrobotics/DQ.h +++ b/include/dqrobotics/DQ.h @@ -649,17 +649,17 @@ inline const DQ operator-(const DQ& dq, const Scalar& s) noexcept template ::value>::type> /** - * @brief operator - between a DQ and a Scalar. + * @brief operator - between a Scalar and a DQ. * @param s any Scalar (as defined by std::is_arithmetic, bools are purposedly removed using static_assert.) * @param dq a DQ. - * @return the difference between the DQ and the Scalar. + * @return the difference between the Scalar and the DQ. */ inline const DQ operator-(const Scalar& s, const DQ& dq) noexcept { static_assert(!std::is_same(),"Operations between DQs and bools are not supported."); - DQ ret(dq); - ret.q(0)-=s; + DQ ret(-dq); + ret.q(0)+=s; return ret; }