From 8ab101da50a3f631716cec7c01fb0d63163496c6 Mon Sep 17 00:00:00 2001 From: Christoph Kords Date: Thu, 29 Apr 2010 10:33:39 +0000 Subject: [PATCH] safe use of acos function in math_QuaternionToAxisAngle --- code/math.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/math.f90 b/code/math.f90 index 596f04c9c..e826cdecd 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -1386,7 +1386,7 @@ pure function math_transpose3x3(A) real(pReal) halfAngle, sinHalfAngle real(pReal), dimension(4) :: math_QuaternionToAxisAngle - halfAngle = dacos(Q(1)) ! value range 0 to 180 deg + halfAngle = dacos(max(-1.0_pReal, min(1.0_pReal, Q(1)))) ! value range 0 to 180 deg sinHalfAngle = dsin(halfAngle) if (sinHalfAngle <= 1.0e-4_pReal) then ! very small rotation angle?