diff options
-rw-r--r-- | chickadee/math/quaternion.scm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chickadee/math/quaternion.scm b/chickadee/math/quaternion.scm index cf2b4bc..1a5ce68 100644 --- a/chickadee/math/quaternion.scm +++ b/chickadee/math/quaternion.scm @@ -101,8 +101,8 @@ (define-inlinable (quaternion-magnitude q) "Return the magnitude of the quaternion Q." - (sqrt - (+ (square (quaternion-w q)) - (square (quaternion-x q)) - (square (quaternion-y q)) - (square (quaternion-z q))))) + (let ((w (quaternion-w q)) + (x (quaternion-x q)) + (y (quaternion-y q)) + (z (quaternion-z q))) + (sqrt (+ (* w w) (* x x) (* y y) (* z z))))) |