--- ./boost/math/octonion.hpp~	2010-03-10 12:09:40.000000000 +0900
+++ ./boost/math/octonion.hpp	2011-05-20 17:58:33.000000000 +0900
@@ -4791,10 +4791,10 @@
         {
             octonion  <T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : octonion  <T>(0, 1, 0, 0, 0, 0, 0, 0);
 #if 1
-            // asin(q) = 1/UVq log(UVq q + sqrt(1 - q^2))
-            //  = -UVq log(UVq q + sqrt(1 - q^2))
-            //return(-u*log((u)*q + sqrt(static_cast<T>(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0
-            octonion  <T> r = -u*log((u)*q + sqrt(static_cast<T>(1) - pow(q, 2)));
+            // asin(q) = 1/UVq log(q UVq + sqrt(1 - q^2))
+            //  = -UVq log(q UVq + sqrt(1 - q^2))
+            //return(-u*log(q*(u) + sqrt(static_cast<T>(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0
+            octonion  <T> r = -u*log(q*(u) + sqrt(static_cast<T>(1) - pow(q, 2)));
             return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 0) ? 1 : -1));
 #else
             // asin(z) = 1/UVq asinh(UVq z)
@@ -4820,10 +4820,10 @@
                                      (q.R_component_8()==static_cast<T>(0)) ? 0 : q.R_component_8()*inf));
             octonion  <T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : octonion  <T>(0, 1, 0, 0, 0, 0, 0, 0);
 #if 1
-            // atan(q) = 1/(2UVq) log( (1+UVq.q)/(1-UVq.q) )
-            //  = -UVq/2 log( (1+UVq.q)/(1-UVq.q) )
-            //return(-u/static_cast<T>(2)*log((static_cast<T>(1)+(u)*q)/(static_cast<T>(1)-(u)*q)));
-            octonion  <T> d = static_cast<T>(1)-(u)*q, c = (static_cast<T>(1)+(u)*q)/d, r = -u/static_cast<T>(2)*log(c);
+            // atan(q) = 1/(2UVq) log( (1+q UVq)/(1-q UVq) )
+            //  = -UVq/2 log( (1+q UVq)/(1-q UVq) )
+            //return(-u/static_cast<T>(2)*log((static_cast<T>(1)+q*(u))/(static_cast<T>(1)-q*(u))));
+            octonion  <T> d = static_cast<T>(1)-q*(u), c = (static_cast<T>(1)+q*(u))/d, r = -u/static_cast<T>(2)*log(c);
             //return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? r : octonion  <T>(0));
             return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((abs(unreal(q)) != static_cast<T>(0)) ? r : octonion  <T>(real(r))) : octonion  <T>(0));
             // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
@@ -4865,9 +4865,9 @@
                                      (q.R_component_6()==static_cast<T>(0)) ? 0 : q.R_component_6()*inf,
                                      (q.R_component_7()==static_cast<T>(0)) ? 0 : q.R_component_7()*inf,
                                      (q.R_component_8()==static_cast<T>(0)) ? 0 : q.R_component_8()*inf));
-            // atanh(q) = 1/2 log( (1+q)/(1-q) )
-            //return(static_cast<T>(1)/static_cast<T>(2)*log((static_cast<T>(1)+q)/(static_cast<T>(1)-q)));
-            octonion  <T> d = (static_cast<T>(1)-q), c = (static_cast<T>(1)+q)/d, r = static_cast<T>(1)/static_cast<T>(2)*log(c);
+            // atanh(q) = 1/2 log( (1-q)^{-1} (1+q) )
+            //return(static_cast<T>(1)/static_cast<T>(2)*log(static_cast<T>(1)/(static_cast<T>(1)-q)*(static_cast<T>(1)+q)));
+            octonion  <T> d = (static_cast<T>(1)-q), c = static_cast<T>(1)/d*(static_cast<T>(1)+q), r = static_cast<T>(1)/static_cast<T>(2)*log(c);
             //return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? r : octonion  <T>(0));
             return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((real(q) != static_cast<T>(0)) ? r : unreal(r)) : octonion  <T>(0));
         }
--- ./boost/math/quaternion.hpp~	2010-03-10 12:09:40.000000000 +0900
+++ ./boost/math/quaternion.hpp	2011-05-20 16:35:53.000000000 +0900
@@ -1985,10 +1985,10 @@
         {
             quaternion<T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : quaternion<T>(0, 1, 0, 0);
 #if 1
-            // asin(q) = 1/UVq log(UVq q + sqrt(1 - q^2))
-            //  = -UVq log(UVq q + sqrt(1 - q^2))
-            //return(-u*log((u)*q + sqrt(static_cast<T>(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0
-            quaternion<T> r = -u*log((u)*q + sqrt(static_cast<T>(1) - pow(q, 2)));
+            // asin(q) = 1/UVq log(q UVq + sqrt(1 - q^2))
+            //  = -UVq log(q UVq + sqrt(1 - q^2))
+            //return(-u*log(q*(u) + sqrt(static_cast<T>(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0
+            quaternion<T> r = -u*log(q*(u) + sqrt(static_cast<T>(1) - pow(q, 2)));
             return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 0) ? 1 : -1));
 #else
             // asin(z) = 1/UVq asinh(UVq z)
@@ -2010,10 +2010,10 @@
                                      (q.R_component_4()==static_cast<T>(0)) ? 0 : q.R_component_4()*inf));
             quaternion<T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : quaternion<T>(0, 1, 0, 0);
 #if 1
-            // atan(q) = 1/(2UVq) log( (1+UVq.q)/(1-UVq.q) )
-            //  = -UVq/2 log( (1+UVq.q)/(1-UVq.q) )
-            //return(-u/static_cast<T>(2)*log((static_cast<T>(1)+(u)*q)/(static_cast<T>(1)-(u)*q)));
-            quaternion<T> d = static_cast<T>(1)-(u)*q, c = (static_cast<T>(1)+(u)*q)/d, r = -u/static_cast<T>(2)*log(c);
+            // atan(q) = 1/(2UVq) log( (1+q UVq)/(1-q UVq) )
+            //  = -UVq/2 log( (1+q UVq)/(1-q UVq) )
+            //return(-u/static_cast<T>(2)*log((static_cast<T>(1)+q*(u))/(static_cast<T>(1)-q*(u))));
+            quaternion<T> d = static_cast<T>(1)-q*(u), c = (static_cast<T>(1)+q*(u))/d, r = -u/static_cast<T>(2)*log(c);
             //return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? r : quaternion<T>(0));
             return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((abs(unreal(q)) != static_cast<T>(0)) ? r : quaternion<T>(real(r))) : quaternion<T>(0));
             // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
@@ -2051,9 +2051,9 @@
                                      (q.R_component_2()==static_cast<T>(0)) ? 0 : q.R_component_2()*inf,
                                      (q.R_component_3()==static_cast<T>(0)) ? 0 : q.R_component_3()*inf,
                                      (q.R_component_4()==static_cast<T>(0)) ? 0 : q.R_component_4()*inf));
-            // atanh(q) = 1/2 log( (1+q)/(1-q) )
-            //return(static_cast<T>(1)/static_cast<T>(2)*log((static_cast<T>(1)+q)/(static_cast<T>(1)-q)));
-            quaternion<T> d = (static_cast<T>(1)-q), c = (static_cast<T>(1)+q)/d, r = static_cast<T>(1)/static_cast<T>(2)*log(c);
+            // atanh(q) = 1/2 log( (1-q)^{-1} (1+q) )
+            //return(static_cast<T>(1)/static_cast<T>(2)*log(static_cast<T>(1)/(static_cast<T>(1)-q)*(static_cast<T>(1)+q)));
+            quaternion<T> d = (static_cast<T>(1)-q), c = static_cast<T>(1)/d*(static_cast<T>(1)+q), r = static_cast<T>(1)/static_cast<T>(2)*log(c);
             //return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? r : quaternion<T>(0));
             return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((real(q) != static_cast<T>(0)) ? r : unreal(r)) : quaternion<T>(0));
         }
