--- ./boost/math/octonion.hpp~	2011-08-01 22:14:24.000000000 +0900
+++ ./boost/math/octonion.hpp	2011-08-02 21:24:08.000000000 +0900
@@ -4780,8 +4780,10 @@
 #else
             // acos(q) = 1/UVq acosh(q)
             //return(static_cast<T>(1)/u*acosh(q)); // the signs of imagpart are different with complex ones when |Vq| == 0
-            octonion  <T> r = static_cast<T>(1)/u*acosh(q);
-            return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0)) ? 1 : -1));
+            octonion  <T> s = sqrt(pow(q, 2) - static_cast<T>(1)), r = log(q + s);
+            r = (real(r) < 0) ? log(q - s) : r;
+	    r = static_cast<T>(1)/u*r; // the signs of imagpart are different with complex ones when |Vq| == 0 && |Sq| > 1
+	    return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || !(std::abs(real(q)) > 1)) ? 1 : -1));
 #endif
         }
         
@@ -4799,7 +4801,8 @@
 #else
             // asin(q) = 1/UVq asinh(q UVq)
             //return(static_cast<T>(1)/u*asinh(q*u)); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0
-            octonion  <T> r = static_cast<T>(1)/u*asinh(q*u);
+            octonion  <T> p = q*u;
+            octonion  <T> r = static_cast<T>(1)/u*log(p + sqrt(pow(p, 2) + static_cast<T>(1)));
             return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 0) ? 1 : -1));
 #endif
         }
@@ -4829,7 +4832,13 @@
             // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
 #else
             // atan(q) = -UVq atanh(q UVq)
-            return(static_cast<T>(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
+            //return(static_cast<T>(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
+	    octonion  <T> p = q*u;
+	    octonion  <T> v = (abs(unreal(p)) != static_cast<T>(0)) ? unreal(p)/abs(unreal(p)) : octonion  <T>(0, 1, 0, 0, 0, 0, 0, 0);
+            octonion  <T> d = (static_cast<T>(1)-p), c = static_cast<T>(1)/d*(static_cast<T>(1)+p), r = static_cast<T>(1)/static_cast<T>(2)*log(c);
+            r = (abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((real(p) != static_cast<T>(0)) ? r : r.unreal()) : octonion  <T>(0);
+	    r = -u*r;
+	    return(r); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
 #endif
         }
         
@@ -4837,18 +4846,40 @@
         template<typename T>
         inline octonion  <T>                    acosh(octonion  <T> const & q)
         {
+#if 1
             // acosh(q) = log(q + sqrt(q^2 - 1))
             //return(log(q + sqrt(pow(q, 2) - static_cast<T>(1))));
             octonion  <T> s = sqrt(pow(q, 2) - static_cast<T>(1)), r = log(q + s);
-            return((real(r) < 0) ? log(q - s) : r);
+            r = (real(r) < 0) ? log(q - s) : r; // the signs of imagpart are different with complex ones when |Vq| == 0 && |Sq| > 1
+	    return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || !(std::abs(real(q)) > 1)) ? 1 : -1));
+#else
+            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);
+	    // acosh(q) = UVq acos(q)
+	    //return(u*acos(q)); // the signs of realpart are different with complex ones when |Vq| == 0
+            octonion  <T> r = log(q + (u)*sqrt(static_cast<T>(1) - pow(q, 2)));
+	    // the signs of realpart are different with complex ones when |Vq| == 0 && Sq > 1
+	    //return(r.real()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 1) ? 1 : -1) + r.unreal()); // the values of imagpart are different when |Vq| == 0 && Sq > 1
+	    r = r.real()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 1) ? 1 : -1) + ((abs(unreal(q)) != static_cast<T>(0) || real(q) < 1) ? r.unreal() : octonion  <T>(0));
+	    // the signs of imagpart are different with complex ones when |Vq| == 0 && |Sq| > 1
+	    return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || !(std::abs(real(q)) > 1)) ? 1 : -1));
+#endif
         }
         
         
         template<typename T>
         inline octonion  <T>                    asinh(octonion  <T> const & q)
         {
+#if 1
             // asinh(q) = log(q + sqrt(q^2 + 1))
             return(log(q + sqrt(pow(q, 2) + static_cast<T>(1)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1
+#else
+            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);
+	    // asinh(q) = UVq asin(-q UVq)
+	    //return(u*asin(-q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < 1
+	    octonion  <T> p = -q*u;
+	    octonion  <T> v = (abs(unreal(p)) != static_cast<T>(0)) ? unreal(p)/abs(unreal(p)) : octonion  <T>(0, 1, 0, 0, 0, 0, 0, 0);
+	    return(u*(-v*log(p*v + sqrt(static_cast<T>(1) - pow(p, 2))))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1
+#endif
         }
         
         
@@ -4865,11 +4896,23 @@
                                      (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));
+#if 1
             // 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));
+            //return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? r : octonion  <T>(0)); // the values of realpart are different when Sq == 0
+            return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((real(q) != static_cast<T>(0)) ? r : r.unreal()) : octonion  <T>(0));
+#else
+            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);
+	    // atanh(q) = UVq atan(-q UVq)
+	    //return(u*atan(-q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < 0
+	    octonion  <T> p = -q*u;
+	    octonion  <T> v = (abs(unreal(p)) != static_cast<T>(0)) ? unreal(p)/abs(unreal(p)) : octonion  <T>(0, 1, 0, 0, 0, 0, 0, 0);
+	    octonion  <T> d = static_cast<T>(1)-p*v, c = static_cast<T>(1)/d*(static_cast<T>(1)+p*v), r = -v/static_cast<T>(2)*log(c);
+	    r = (abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((abs(unreal(p)) != static_cast<T>(0)) ? r : octonion  <T>(real(r))) : octonion  <T>(0);
+	    r = u*r; // the signs of imagpart are different with complex ones when Sq > 1 && |Vq| == 0
+	    return(r.real() + r.unreal()*static_cast<T>((real(q) < 1 || abs(unreal(q)) != static_cast<T>(0)) ? 1: -1));
+#endif
         }
 
        
--- ./boost/math/quaternion.hpp~	2011-08-01 22:06:15.000000000 +0900
+++ ./boost/math/quaternion.hpp	2011-08-02 20:25:05.000000000 +0900
@@ -1974,8 +1974,10 @@
 #else
             // acos(q) = 1/UVq acosh(q)
             //return(static_cast<T>(1)/u*acosh(q)); // the signs of imagpart are different with complex ones when |Vq| == 0
-            quaternion<T> r = static_cast<T>(1)/u*acosh(q);
-            return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0)) ? 1 : -1));
+            quaternion<T> s = sqrt(pow(q, 2) - static_cast<T>(1)), r = log(q + s);
+            r = (real(r) < 0) ? log(q - s) : r;
+	    r = static_cast<T>(1)/u*r; // the signs of imagpart are different with complex ones when |Vq| == 0 && |Sq| > 1
+	    return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || !(std::abs(real(q)) > 1)) ? 1 : -1));
 #endif
         }
         
@@ -1993,7 +1995,8 @@
 #else
             // asin(q) = 1/UVq asinh(q UVq)
             //return(static_cast<T>(1)/u*asinh(q*u)); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0
-            quaternion<T> r = static_cast<T>(1)/u*asinh(q*u);
+            quaternion<T> p = q*u;
+            quaternion<T> r = static_cast<T>(1)/u*log(p + sqrt(pow(p, 2) + static_cast<T>(1)));
             return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 0) ? 1 : -1));
 #endif
         }
@@ -2019,7 +2022,13 @@
             // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
 #else
             // atan(q) = -UVq atanh(q UVq)
-            return(static_cast<T>(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
+            //return(static_cast<T>(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
+	    quaternion<T> p = q*u;
+	    quaternion<T> v = (abs(unreal(p)) != static_cast<T>(0)) ? unreal(p)/abs(unreal(p)) : quaternion<T>(0, 1, 0, 0);
+            quaternion<T> d = (static_cast<T>(1)-p), c = static_cast<T>(1)/d*(static_cast<T>(1)+p), r = static_cast<T>(1)/static_cast<T>(2)*log(c);
+            r = (abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((real(p) != static_cast<T>(0)) ? r : r.unreal()) : quaternion<T>(0);
+	    r = -u*r;
+	    return(r); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1
 #endif
         }
         
@@ -2027,18 +2036,40 @@
         template<typename T>
         inline quaternion<T>                    acosh(quaternion<T> const & q)
         {
+#if 1
             // acosh(q) = log(q + sqrt(q^2 - 1))
             //return(log(q + sqrt(pow(q, 2) - static_cast<T>(1))));
             quaternion<T> s = sqrt(pow(q, 2) - static_cast<T>(1)), r = log(q + s);
-            return((real(r) < 0) ? log(q - s) : r);
+            r = (real(r) < 0) ? log(q - s) : r; // the signs of imagpart are different with complex ones when |Vq| == 0 && |Sq| > 1
+	    return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || !(std::abs(real(q)) > 1)) ? 1 : -1));
+#else
+            quaternion<T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : quaternion<T>(0, 1, 0, 0);
+	    // acosh(q) = UVq acos(q)
+	    //return(u*acos(q)); // the signs of realpart are different with complex ones when |Vq| == 0
+            quaternion<T> r = log(q + (u)*sqrt(static_cast<T>(1) - pow(q, 2)));
+	    // the signs of realpart are different with complex ones when |Vq| == 0 && Sq > 1
+	    //return(r.real()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 1) ? 1 : -1) + r.unreal()); // the values of imagpart are different when |Vq| == 0 && Sq > 1
+	    r = r.real()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || real(q) < 1) ? 1 : -1) + ((abs(unreal(q)) != static_cast<T>(0) || real(q) < 1) ? r.unreal() : quaternion<T>(0));
+	    // the signs of imagpart are different with complex ones when |Vq| == 0 && |Sq| > 1
+	    return(r.real() + r.unreal()*static_cast<T>((abs(unreal(q)) != static_cast<T>(0) || !(std::abs(real(q)) > 1)) ? 1 : -1));
+#endif
         }
         
         
         template<typename T>
         inline quaternion<T>                    asinh(quaternion<T> const & q)
         {
+#if 1
             // asinh(q) = log(q + sqrt(q^2 + 1))
             return(log(q + sqrt(pow(q, 2) + static_cast<T>(1)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1
+#else
+            quaternion<T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : quaternion<T>(0, 1, 0, 0);
+	    // asinh(q) = UVq asin(-q UVq)
+	    //return(u*asin(-q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < 1
+	    quaternion<T> p = -q*u;
+	    quaternion<T> v = (abs(unreal(p)) != static_cast<T>(0)) ? unreal(p)/abs(unreal(p)) : quaternion<T>(0, 1, 0, 0);
+	    return(u*(-v*log(p*v + sqrt(static_cast<T>(1) - pow(p, 2))))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1
+#endif
         }
         
         
@@ -2051,11 +2082,23 @@
                                      (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));
+#if 1
             // 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));
+            //return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? r : quaternion<T>(0)); // the values of realpart are different when Sq == 0
+            return((abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((real(q) != static_cast<T>(0)) ? r : r.unreal()) : quaternion<T>(0));
+#else
+            quaternion<T> u = (abs(unreal(q)) != static_cast<T>(0)) ? unreal(q)/abs(unreal(q)) : quaternion<T>(0, 1, 0, 0);
+	    // atanh(q) = UVq atan(-q UVq)
+	    //return(u*atan(-q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < 0
+	    quaternion<T> p = -q*u;
+	    quaternion<T> v = (abs(unreal(p)) != static_cast<T>(0)) ? unreal(p)/abs(unreal(p)) : quaternion<T>(0, 1, 0, 0);
+	    quaternion<T> d = static_cast<T>(1)-p*v, c = static_cast<T>(1)/d*(static_cast<T>(1)+p*v), r = -v/static_cast<T>(2)*log(c);
+	    r = (abs(d) != static_cast<T>(0) && abs(c) != static_cast<T>(0)) ? ((abs(unreal(p)) != static_cast<T>(0)) ? r : quaternion<T>(real(r))) : quaternion<T>(0);
+	    r = u*r; // the signs of imagpart are different with complex ones when Sq > 1 && |Vq| == 0
+	    return(r.real() + r.unreal()*static_cast<T>((real(q) < 1 || abs(unreal(q)) != static_cast<T>(0)) ? 1: -1));
+#endif
         }
 
 
