From e6d09368428395d7fc6198ba3ef2a20e9def4496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Mon, 25 Feb 2019 05:13:59 +0000 Subject: [PATCH] Fix exp of a real quaternion Former-commit-id: 2bd5c22c3690330e3881bd509bf4070cf2a21015 --- qpms/wigner.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qpms/wigner.h b/qpms/wigner.h index 13e16fe..5124e7c 100644 --- a/qpms/wigner.h +++ b/qpms/wigner.h @@ -61,7 +61,7 @@ static inline qpms_quat_t qpms_quat_exp(const qpms_quat_t q) { const qpms_quat4d_t q4 = qpms_quat_4d_from_2c(q); const double vn = sqrt(q4.ci*q4.ci + q4.cj*q4.cj + q4.ck *q4.ck); const double ea = exp(q4.c1); - const double cv = ea*sin(vn)/vn; // "vector" part common prefactor + const double cv = vn ? (ea*sin(vn)/vn) : ea; // "vector" part common prefactor const qpms_quat4d_t r4 = {ea * cos(vn), cv*q4.ci, cv*q4.cj, cv*q4.ck}; return qpms_quat_2c_from_4d(r4); }