epoc32/include/stdapis/boost/math/octonion.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/math/octonion.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,4754 @@
     1.4 +//    boost octonion.hpp header file
     1.5 +
     1.6 +//  (C) Copyright Hubert Holin 2001.
     1.7 +//  Distributed under the Boost Software License, Version 1.0. (See
     1.8 +//  accompanying file LICENSE_1_0.txt or copy at
     1.9 +//  http://www.boost.org/LICENSE_1_0.txt)
    1.10 +
    1.11 +// See http://www.boost.org for updates, documentation, and revision history.
    1.12 +
    1.13 +
    1.14 +#ifndef BOOST_OCTONION_HPP
    1.15 +#define BOOST_OCTONION_HPP
    1.16 +
    1.17 +#include <boost/math/quaternion.hpp>
    1.18 +
    1.19 +
    1.20 +namespace boost
    1.21 +{
    1.22 +    namespace math
    1.23 +    {
    1.24 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
    1.25 +        // gcc 2.95.x uses expression templates for valarray calculations, but
    1.26 +        // the result is not conforming. We need BOOST_GET_VALARRAY to get an
    1.27 +        // actual valarray result when we need to call a member function
    1.28 +    #define    BOOST_GET_VALARRAY(T,x)    ::std::valarray<T>(x)
    1.29 +        // gcc 2.95.x has an "std::ios" class that is similar to 
    1.30 +        // "std::ios_base", so we just use a #define
    1.31 +    #define    BOOST_IOS_BASE    ::std::ios
    1.32 +        // gcc 2.x ignores function scope using declarations,
    1.33 +        // put them in the scope of the enclosing namespace instead:
    1.34 +        using    ::std::valarray;
    1.35 +        using    ::std::sqrt;
    1.36 +        using    ::std::cos;
    1.37 +        using    ::std::sin;
    1.38 +        using    ::std::exp;
    1.39 +        using    ::std::cosh;
    1.40 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
    1.41 +    
    1.42 +#define    BOOST_OCTONION_ACCESSOR_GENERATOR(type)                      \
    1.43 +            type                        real() const                    \
    1.44 +            {                                                           \
    1.45 +                return(a);                                              \
    1.46 +            }                                                           \
    1.47 +                                                                        \
    1.48 +            octonion<type>                unreal() const                \
    1.49 +            {                                                           \
    1.50 +                return( octonion<type>(static_cast<type>(0),b,c,d,e,f,g,h));   \
    1.51 +            }                                                           \
    1.52 +                                                                        \
    1.53 +            type                            R_component_1() const       \
    1.54 +            {                                                           \
    1.55 +                return(a);                                              \
    1.56 +            }                                                           \
    1.57 +                                                                        \
    1.58 +            type                            R_component_2() const       \
    1.59 +            {                                                           \
    1.60 +                return(b);                                              \
    1.61 +            }                                                           \
    1.62 +                                                                        \
    1.63 +            type                            R_component_3() const       \
    1.64 +            {                                                           \
    1.65 +                return(c);                                              \
    1.66 +            }                                                           \
    1.67 +                                                                        \
    1.68 +            type                            R_component_4() const       \
    1.69 +            {                                                           \
    1.70 +                return(d);                                              \
    1.71 +            }                                                           \
    1.72 +                                                                        \
    1.73 +            type                            R_component_5() const       \
    1.74 +            {                                                           \
    1.75 +                return(e);                                              \
    1.76 +            }                                                           \
    1.77 +                                                                        \
    1.78 +            type                            R_component_6() const       \
    1.79 +            {                                                           \
    1.80 +                return(f);                                              \
    1.81 +            }                                                           \
    1.82 +                                                                        \
    1.83 +            type                            R_component_7() const       \
    1.84 +            {                                                           \
    1.85 +                return(g);                                              \
    1.86 +            }                                                           \
    1.87 +                                                                        \
    1.88 +            type                            R_component_8() const       \
    1.89 +            {                                                           \
    1.90 +                return(h);                                              \
    1.91 +            }                                                           \
    1.92 +                                                                        \
    1.93 +            ::std::complex<type>            C_component_1() const       \
    1.94 +            {                                                           \
    1.95 +                return(::std::complex<type>(a,b));                      \
    1.96 +            }                                                           \
    1.97 +                                                                        \
    1.98 +            ::std::complex<type>            C_component_2() const       \
    1.99 +            {                                                           \
   1.100 +                return(::std::complex<type>(c,d));                      \
   1.101 +            }                                                           \
   1.102 +                                                                        \
   1.103 +            ::std::complex<type>            C_component_3() const       \
   1.104 +            {                                                           \
   1.105 +                return(::std::complex<type>(e,f));                      \
   1.106 +            }                                                           \
   1.107 +                                                                        \
   1.108 +            ::std::complex<type>            C_component_4() const       \
   1.109 +            {                                                           \
   1.110 +                return(::std::complex<type>(g,h));                      \
   1.111 +            }                                                           \
   1.112 +                                                                        \
   1.113 +            ::boost::math::quaternion<type>    H_component_1() const    \
   1.114 +            {                                                           \
   1.115 +                return(::boost::math::quaternion<type>(a,b,c,d));       \
   1.116 +            }                                                           \
   1.117 +                                                                        \
   1.118 +            ::boost::math::quaternion<type>    H_component_2() const    \
   1.119 +            {                                                           \
   1.120 +                return(::boost::math::quaternion<type>(e,f,g,h));       \
   1.121 +            }
   1.122 +        
   1.123 +    
   1.124 +#define    BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR(type)                                         \
   1.125 +            template<typename X>                                                                    \
   1.126 +            octonion<type> &        operator = (octonion<X> const & a_affecter)                     \
   1.127 +            {                                                                                       \
   1.128 +                a = static_cast<type>(a_affecter.R_component_1());                                  \
   1.129 +                b = static_cast<type>(a_affecter.R_component_2());                                  \
   1.130 +                c = static_cast<type>(a_affecter.R_component_3());                                  \
   1.131 +                d = static_cast<type>(a_affecter.R_component_4());                                  \
   1.132 +                e = static_cast<type>(a_affecter.R_component_5());                                  \
   1.133 +                f = static_cast<type>(a_affecter.R_component_6());                                  \
   1.134 +                g = static_cast<type>(a_affecter.R_component_7());                                  \
   1.135 +                h = static_cast<type>(a_affecter.R_component_8());                                  \
   1.136 +                                                                                                    \
   1.137 +                return(*this);                                                                      \
   1.138 +            }                                                                                       \
   1.139 +                                                                                                    \
   1.140 +            octonion<type> &        operator = (octonion<type> const & a_affecter)                  \
   1.141 +            {                                                                                       \
   1.142 +                a = a_affecter.a;                                                                   \
   1.143 +                b = a_affecter.b;                                                                   \
   1.144 +                c = a_affecter.c;                                                                   \
   1.145 +                d = a_affecter.d;                                                                   \
   1.146 +                e = a_affecter.e;                                                                   \
   1.147 +                f = a_affecter.f;                                                                   \
   1.148 +                g = a_affecter.g;                                                                   \
   1.149 +                h = a_affecter.h;                                                                   \
   1.150 +                                                                                                    \
   1.151 +                return(*this);                                                                      \
   1.152 +            }                                                                                       \
   1.153 +                                                                                                    \
   1.154 +            octonion<type> &        operator = (type const & a_affecter)                            \
   1.155 +            {                                                                                       \
   1.156 +                a = a_affecter;                                                                     \
   1.157 +                                                                                                    \
   1.158 +                b = c = d = e = f= g = h = static_cast<type>(0);                                    \
   1.159 +                                                                                                    \
   1.160 +                return(*this);                                                                      \
   1.161 +            }                                                                                       \
   1.162 +                                                                                                    \
   1.163 +            octonion<type> &        operator = (::std::complex<type> const & a_affecter)            \
   1.164 +            {                                                                                       \
   1.165 +                a = a_affecter.real();                                                              \
   1.166 +                b = a_affecter.imag();                                                              \
   1.167 +                                                                                                    \
   1.168 +                c = d = e = f = g = h = static_cast<type>(0);                                       \
   1.169 +                                                                                                    \
   1.170 +                return(*this);                                                                      \
   1.171 +            }                                                                                       \
   1.172 +                                                                                                    \
   1.173 +            octonion<type> &        operator = (::boost::math::quaternion<type> const & a_affecter) \
   1.174 +            {                                                                                       \
   1.175 +                a = a_affecter.R_component_1();                                                     \
   1.176 +                b = a_affecter.R_component_2();                                                     \
   1.177 +                c = a_affecter.R_component_3();                                                     \
   1.178 +                d = a_affecter.R_component_4();                                                     \
   1.179 +                                                                                                    \
   1.180 +                e = f = g = h = static_cast<type>(0);                                               \
   1.181 +                                                                                                    \
   1.182 +                return(*this);                                                                      \
   1.183 +            }
   1.184 +        
   1.185 +        
   1.186 +#define    BOOST_OCTONION_MEMBER_DATA_GENERATOR(type) \
   1.187 +            type    a;                                \
   1.188 +            type    b;                                \
   1.189 +            type    c;                                \
   1.190 +            type    d;                                \
   1.191 +            type    e;                                \
   1.192 +            type    f;                                \
   1.193 +            type    g;                                \
   1.194 +            type    h;                                \
   1.195 +        
   1.196 +        
   1.197 +        template<typename T>
   1.198 +        class octonion
   1.199 +        {
   1.200 +        public:
   1.201 +            
   1.202 +            typedef T value_type;
   1.203 +            
   1.204 +            // constructor for O seen as R^8
   1.205 +            // (also default constructor)
   1.206 +            
   1.207 +            explicit                octonion(   T const & requested_a = T(),
   1.208 +                                                T const & requested_b = T(),
   1.209 +                                                T const & requested_c = T(),
   1.210 +                                                T const & requested_d = T(),
   1.211 +                                                T const & requested_e = T(),
   1.212 +                                                T const & requested_f = T(),
   1.213 +                                                T const & requested_g = T(),
   1.214 +                                                T const & requested_h = T())
   1.215 +            :   a(requested_a),
   1.216 +                b(requested_b),
   1.217 +                c(requested_c),
   1.218 +                d(requested_d),
   1.219 +                e(requested_e),
   1.220 +                f(requested_f),
   1.221 +                g(requested_g),
   1.222 +                h(requested_h)
   1.223 +            {
   1.224 +                // nothing to do!
   1.225 +            }
   1.226 +            
   1.227 +            
   1.228 +            // constructor for H seen as C^4
   1.229 +                
   1.230 +            explicit                octonion(   ::std::complex<T> const & z0,
   1.231 +                                                ::std::complex<T> const & z1 = ::std::complex<T>(),
   1.232 +                                                ::std::complex<T> const & z2 = ::std::complex<T>(),
   1.233 +                                                ::std::complex<T> const & z3 = ::std::complex<T>())
   1.234 +            :   a(z0.real()),
   1.235 +                b(z0.imag()),
   1.236 +                c(z1.real()),
   1.237 +                d(z1.imag()),
   1.238 +                e(z2.real()),
   1.239 +                f(z2.imag()),
   1.240 +                g(z3.real()),
   1.241 +                h(z3.imag())
   1.242 +            {
   1.243 +                // nothing to do!
   1.244 +            }
   1.245 +            
   1.246 +            
   1.247 +            // constructor for O seen as H^2
   1.248 +                
   1.249 +            explicit                octonion(   ::boost::math::quaternion<T> const & q0,
   1.250 +                                                ::boost::math::quaternion<T> const & q1 = ::boost::math::quaternion<T>())
   1.251 +            :   a(q0.R_component_1()),
   1.252 +                b(q0.R_component_2()),
   1.253 +                c(q0.R_component_3()),
   1.254 +                d(q0.R_component_4()),
   1.255 +                e(q1.R_component_1()),
   1.256 +                f(q1.R_component_2()),
   1.257 +                g(q1.R_component_3()),
   1.258 +                h(q1.R_component_4())
   1.259 +            {
   1.260 +                // nothing to do!
   1.261 +            }
   1.262 +            
   1.263 +            
   1.264 +            // UNtemplated copy constructor
   1.265 +            // (this is taken care of by the compiler itself)
   1.266 +            
   1.267 +            
   1.268 +            // templated copy constructor
   1.269 +            
   1.270 +            template<typename X>
   1.271 +            explicit                octonion(octonion<X> const & a_recopier)
   1.272 +            :   a(static_cast<T>(a_recopier.R_component_1())),
   1.273 +                b(static_cast<T>(a_recopier.R_component_2())),
   1.274 +                c(static_cast<T>(a_recopier.R_component_3())),
   1.275 +                d(static_cast<T>(a_recopier.R_component_4())),
   1.276 +                e(static_cast<T>(a_recopier.R_component_5())),
   1.277 +                f(static_cast<T>(a_recopier.R_component_6())),
   1.278 +                g(static_cast<T>(a_recopier.R_component_7())),
   1.279 +                h(static_cast<T>(a_recopier.R_component_8()))
   1.280 +            {
   1.281 +                // nothing to do!
   1.282 +            }
   1.283 +            
   1.284 +            
   1.285 +            // destructor
   1.286 +            // (this is taken care of by the compiler itself)
   1.287 +            
   1.288 +            
   1.289 +            // accessors
   1.290 +            //
   1.291 +            // Note:    Like complex number, octonions do have a meaningful notion of "real part",
   1.292 +            //            but unlike them there is no meaningful notion of "imaginary part".
   1.293 +            //            Instead there is an "unreal part" which itself is an octonion, and usually
   1.294 +            //            nothing simpler (as opposed to the complex number case).
   1.295 +            //            However, for practicallity, there are accessors for the other components
   1.296 +            //            (these are necessary for the templated copy constructor, for instance).
   1.297 +            
   1.298 +            BOOST_OCTONION_ACCESSOR_GENERATOR(T)
   1.299 +            
   1.300 +            // assignment operators
   1.301 +            
   1.302 +            BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR(T)
   1.303 +            
   1.304 +            // other assignment-related operators
   1.305 +            //
   1.306 +            // NOTE:    Octonion multiplication is *NOT* commutative;
   1.307 +            //            symbolically, "q *= rhs;" means "q = q * rhs;"
   1.308 +            //            and "q /= rhs;" means "q = q * inverse_of(rhs);";
   1.309 +            //            octonion multiplication is also *NOT* associative
   1.310 +            
   1.311 +            octonion<T> &            operator += (T const & rhs)
   1.312 +            {
   1.313 +                T    at = a + rhs;    // exception guard
   1.314 +                
   1.315 +                a = at;
   1.316 +                
   1.317 +                return(*this);
   1.318 +            }
   1.319 +            
   1.320 +            
   1.321 +            octonion<T> &            operator += (::std::complex<T> const & rhs)
   1.322 +            {
   1.323 +                T    at = a + rhs.real();    // exception guard
   1.324 +                T    bt = b + rhs.imag();    // exception guard
   1.325 +                
   1.326 +                a = at; 
   1.327 +                b = bt;
   1.328 +                
   1.329 +                return(*this);
   1.330 +            }
   1.331 +            
   1.332 +            
   1.333 +            octonion<T> &            operator += (::boost::math::quaternion<T> const & rhs)
   1.334 +            {
   1.335 +                T    at = a + rhs.R_component_1();    // exception guard
   1.336 +                T    bt = b + rhs.R_component_2();    // exception guard
   1.337 +                T    ct = c + rhs.R_component_3();    // exception guard
   1.338 +                T    dt = d + rhs.R_component_4();    // exception guard
   1.339 +                
   1.340 +                a = at; 
   1.341 +                b = bt;
   1.342 +                c = ct;
   1.343 +                d = dt;
   1.344 +                
   1.345 +                return(*this);
   1.346 +            }
   1.347 +            
   1.348 +            
   1.349 +            template<typename X>
   1.350 +            octonion<T> &            operator += (octonion<X> const & rhs)
   1.351 +            {
   1.352 +                T    at = a + static_cast<T>(rhs.R_component_1());    // exception guard
   1.353 +                T    bt = b + static_cast<T>(rhs.R_component_2());    // exception guard
   1.354 +                T    ct = c + static_cast<T>(rhs.R_component_3());    // exception guard
   1.355 +                T    dt = d + static_cast<T>(rhs.R_component_4());    // exception guard
   1.356 +                T    et = e + static_cast<T>(rhs.R_component_5());    // exception guard
   1.357 +                T    ft = f + static_cast<T>(rhs.R_component_6());    // exception guard
   1.358 +                T    gt = g + static_cast<T>(rhs.R_component_7());    // exception guard
   1.359 +                T    ht = h + static_cast<T>(rhs.R_component_8());    // exception guard
   1.360 +                
   1.361 +                a = at;
   1.362 +                b = bt;
   1.363 +                c = ct;
   1.364 +                d = dt;
   1.365 +                e = et;
   1.366 +                f = ft;
   1.367 +                g = gt;
   1.368 +                h = ht;
   1.369 +                
   1.370 +                return(*this);
   1.371 +            }
   1.372 +            
   1.373 +            
   1.374 +            
   1.375 +            octonion<T> &            operator -= (T const & rhs)
   1.376 +            {
   1.377 +                T    at = a - rhs;    // exception guard
   1.378 +                
   1.379 +                a = at;
   1.380 +                
   1.381 +                return(*this);
   1.382 +            }
   1.383 +            
   1.384 +            
   1.385 +            octonion<T> &            operator -= (::std::complex<T> const & rhs)
   1.386 +            {
   1.387 +                T    at = a - rhs.real();    // exception guard
   1.388 +                T    bt = b - rhs.imag();    // exception guard
   1.389 +                
   1.390 +                a = at; 
   1.391 +                b = bt;
   1.392 +                
   1.393 +                return(*this);
   1.394 +            }
   1.395 +            
   1.396 +            
   1.397 +            octonion<T> &            operator -= (::boost::math::quaternion<T> const & rhs)
   1.398 +            {
   1.399 +                T    at = a - rhs.R_component_1();    // exception guard
   1.400 +                T    bt = b - rhs.R_component_2();    // exception guard
   1.401 +                T    ct = c - rhs.R_component_3();    // exception guard
   1.402 +                T    dt = d - rhs.R_component_4();    // exception guard
   1.403 +                
   1.404 +                a = at; 
   1.405 +                b = bt;
   1.406 +                c = ct;
   1.407 +                d = dt;
   1.408 +                
   1.409 +                return(*this);
   1.410 +            }
   1.411 +            
   1.412 +            
   1.413 +            template<typename X>
   1.414 +            octonion<T> &            operator -= (octonion<X> const & rhs)
   1.415 +            {
   1.416 +                T    at = a - static_cast<T>(rhs.R_component_1());    // exception guard
   1.417 +                T    bt = b - static_cast<T>(rhs.R_component_2());    // exception guard
   1.418 +                T    ct = c - static_cast<T>(rhs.R_component_3());    // exception guard
   1.419 +                T    dt = d - static_cast<T>(rhs.R_component_4());    // exception guard
   1.420 +                T    et = e - static_cast<T>(rhs.R_component_5());    // exception guard
   1.421 +                T    ft = f - static_cast<T>(rhs.R_component_6());    // exception guard
   1.422 +                T    gt = g - static_cast<T>(rhs.R_component_7());    // exception guard
   1.423 +                T    ht = h - static_cast<T>(rhs.R_component_8());    // exception guard
   1.424 +                
   1.425 +                a = at;
   1.426 +                b = bt;
   1.427 +                c = ct;
   1.428 +                d = dt;
   1.429 +                e = et;
   1.430 +                f = ft;
   1.431 +                g = gt;
   1.432 +                h = ht;
   1.433 +                
   1.434 +                return(*this);
   1.435 +            }
   1.436 +            
   1.437 +            
   1.438 +            octonion<T> &            operator *= (T const & rhs)
   1.439 +            {
   1.440 +                T    at = a * rhs;    // exception guard
   1.441 +                T    bt = b * rhs;    // exception guard
   1.442 +                T    ct = c * rhs;    // exception guard
   1.443 +                T    dt = d * rhs;    // exception guard
   1.444 +                T    et = e * rhs;    // exception guard
   1.445 +                T    ft = f * rhs;    // exception guard
   1.446 +                T    gt = g * rhs;    // exception guard
   1.447 +                T    ht = h * rhs;    // exception guard
   1.448 +                
   1.449 +                a = at;
   1.450 +                b = bt;
   1.451 +                c = ct;
   1.452 +                d = dt;
   1.453 +                e = et;
   1.454 +                f = ft;
   1.455 +                g = gt;
   1.456 +                h = ht;
   1.457 +                
   1.458 +                return(*this);
   1.459 +            }
   1.460 +            
   1.461 +            
   1.462 +            octonion<T> &            operator *= (::std::complex<T> const & rhs)
   1.463 +            {
   1.464 +                T    ar = rhs.real();
   1.465 +                T    br = rhs.imag();
   1.466 +                
   1.467 +                T    at = +a*ar-b*br;
   1.468 +                T    bt = +a*br+b*ar;
   1.469 +                T    ct = +c*ar+d*br;
   1.470 +                T    dt = -c*br+d*ar;
   1.471 +                T    et = +e*ar+f*br;
   1.472 +                T    ft = -e*br+f*ar;
   1.473 +                T    gt = +g*ar-h*br;
   1.474 +                T    ht = +g*br+h*ar;
   1.475 +                
   1.476 +                a = at;
   1.477 +                b = bt;
   1.478 +                c = ct;
   1.479 +                d = dt;
   1.480 +                e = et;
   1.481 +                f = ft;
   1.482 +                g = gt;
   1.483 +                h = ht;
   1.484 +                
   1.485 +                return(*this);
   1.486 +            }
   1.487 +            
   1.488 +            
   1.489 +            octonion<T> &            operator *= (::boost::math::quaternion<T> const & rhs)
   1.490 +            {
   1.491 +                T    ar = rhs.R_component_1();
   1.492 +                T    br = rhs.R_component_2();
   1.493 +                T    cr = rhs.R_component_2();
   1.494 +                T    dr = rhs.R_component_2();
   1.495 +                
   1.496 +                T    at = +a*ar-b*br-c*cr-d*dr;
   1.497 +                T    bt = +a*br+b*ar+c*dr-d*cr;
   1.498 +                T    ct = +a*cr-b*dr+c*ar+d*br;
   1.499 +                T    dt = +a*dr+b*cr-c*br+d*ar;
   1.500 +                T    et = +e*ar+f*br+g*cr+h*dr;
   1.501 +                T    ft = -e*br+f*ar-g*dr+h*cr;
   1.502 +                T    gt = -e*cr+f*dr+g*ar-h*br;
   1.503 +                T    ht = -e*dr-f*cr+g*br+h*ar;
   1.504 +                
   1.505 +                a = at;
   1.506 +                b = bt;
   1.507 +                c = ct;
   1.508 +                d = dt;
   1.509 +                e = et;
   1.510 +                f = ft;
   1.511 +                g = gt;
   1.512 +                h = ht;
   1.513 +                
   1.514 +                return(*this);
   1.515 +            }
   1.516 +            
   1.517 +            
   1.518 +            template<typename X>
   1.519 +            octonion<T> &            operator *= (octonion<X> const & rhs)
   1.520 +            {
   1.521 +                T    ar = static_cast<T>(rhs.R_component_1());
   1.522 +                T    br = static_cast<T>(rhs.R_component_2());
   1.523 +                T    cr = static_cast<T>(rhs.R_component_3());
   1.524 +                T    dr = static_cast<T>(rhs.R_component_4());
   1.525 +                T    er = static_cast<T>(rhs.R_component_5());
   1.526 +                T    fr = static_cast<T>(rhs.R_component_6());
   1.527 +                T    gr = static_cast<T>(rhs.R_component_7());
   1.528 +                T    hr = static_cast<T>(rhs.R_component_8());
   1.529 +                
   1.530 +                T    at = +a*ar-b*br-c*cr-d*dr-e*er-f*fr-g*gr-h*hr;
   1.531 +                T    bt = +a*br+b*ar+c*dr-d*cr+e*fr-f*er-g*hr+h*gr;
   1.532 +                T    ct = +a*cr-b*dr+c*ar+d*br+e*gr+f*hr-g*er-h*fr;
   1.533 +                T    dt = +a*dr+b*cr-c*br+d*ar+e*hr-f*gr+g*fr-h*er;
   1.534 +                T    et = +a*er-b*fr-c*gr-d*hr+e*ar+f*br+g*cr+h*dr;
   1.535 +                T    ft = +a*fr+b*er-c*hr+d*gr-e*br+f*ar-g*dr+h*cr;
   1.536 +                T    gt = +a*gr+b*hr+c*er-d*fr-e*cr+f*dr+g*ar-h*br;
   1.537 +                T    ht = +a*hr-b*gr+c*fr+d*er-e*dr-f*cr+g*br+h*ar;
   1.538 +                
   1.539 +                a = at;
   1.540 +                b = bt;
   1.541 +                c = ct;
   1.542 +                d = dt;
   1.543 +                e = et;
   1.544 +                f = ft;
   1.545 +                g = gt;
   1.546 +                h = ht;
   1.547 +                
   1.548 +                return(*this);
   1.549 +            }
   1.550 +            
   1.551 +            
   1.552 +            octonion<T> &            operator /= (T const & rhs)
   1.553 +            {
   1.554 +                T    at = a / rhs;    // exception guard
   1.555 +                T    bt = b / rhs;    // exception guard
   1.556 +                T    ct = c / rhs;    // exception guard
   1.557 +                T    dt = d / rhs;    // exception guard
   1.558 +                T    et = e / rhs;    // exception guard
   1.559 +                T    ft = f / rhs;    // exception guard
   1.560 +                T    gt = g / rhs;    // exception guard
   1.561 +                T    ht = h / rhs;    // exception guard
   1.562 +                
   1.563 +                a = at;
   1.564 +                b = bt;
   1.565 +                c = ct;
   1.566 +                d = dt;
   1.567 +                e = et;
   1.568 +                f = ft;
   1.569 +                g = gt;
   1.570 +                h = ht;
   1.571 +                
   1.572 +                return(*this);
   1.573 +            }
   1.574 +            
   1.575 +            
   1.576 +            octonion<T> &            operator /= (::std::complex<T> const & rhs)
   1.577 +            {
   1.578 +                T    ar = rhs.real();
   1.579 +                T    br = rhs.imag();
   1.580 +                
   1.581 +                T    denominator = ar*ar+br*br;
   1.582 +                
   1.583 +                T    at = (+a*ar-b*br)/denominator;
   1.584 +                T    bt = (-a*br+b*ar)/denominator;
   1.585 +                T    ct = (+c*ar-d*br)/denominator;
   1.586 +                T    dt = (+c*br+d*ar)/denominator;
   1.587 +                T    et = (+e*ar-f*br)/denominator;
   1.588 +                T    ft = (+e*br+f*ar)/denominator;
   1.589 +                T    gt = (+g*ar+h*br)/denominator;
   1.590 +                T    ht = (+g*br+h*ar)/denominator;
   1.591 +                
   1.592 +                a = at;
   1.593 +                b = bt;
   1.594 +                c = ct;
   1.595 +                d = dt;
   1.596 +                e = et;
   1.597 +                f = ft;
   1.598 +                g = gt;
   1.599 +                h = ht;
   1.600 +                
   1.601 +                return(*this);
   1.602 +            }
   1.603 +            
   1.604 +            
   1.605 +            octonion<T> &            operator /= (::boost::math::quaternion<T> const & rhs)
   1.606 +            {
   1.607 +                T    ar = rhs.R_component_1();
   1.608 +                T    br = rhs.R_component_2();
   1.609 +                T    cr = rhs.R_component_2();
   1.610 +                T    dr = rhs.R_component_2();
   1.611 +                
   1.612 +                T    denominator = ar*ar+br*br+cr*cr+dr*dr;
   1.613 +                
   1.614 +                T    at = (+a*ar+b*br+c*cr+d*dr)/denominator;
   1.615 +                T    bt = (-a*br+b*ar-c*dr+d*cr)/denominator;
   1.616 +                T    ct = (-a*cr+b*dr+c*ar-d*br)/denominator;
   1.617 +                T    dt = (-a*dr-b*cr+c*br+d*ar)/denominator;
   1.618 +                T    et = (+e*ar-f*br-g*cr-h*dr)/denominator;
   1.619 +                T    ft = (+e*br+f*ar+g*dr-h*cr)/denominator;
   1.620 +                T    gt = (+e*cr-f*dr+g*ar+h*br)/denominator;
   1.621 +                T    ht = (+e*dr+f*cr-g*br+h*ar)/denominator;
   1.622 +                
   1.623 +                a = at;
   1.624 +                b = bt;
   1.625 +                c = ct;
   1.626 +                d = dt;
   1.627 +                e = et;
   1.628 +                f = ft;
   1.629 +                g = gt;
   1.630 +                h = ht;
   1.631 +                
   1.632 +                return(*this);
   1.633 +            }
   1.634 +            
   1.635 +            
   1.636 +            template<typename X>
   1.637 +            octonion<T> &            operator /= (octonion<X> const & rhs)
   1.638 +            {
   1.639 +                T    ar = static_cast<T>(rhs.R_component_1());
   1.640 +                T    br = static_cast<T>(rhs.R_component_2());
   1.641 +                T    cr = static_cast<T>(rhs.R_component_3());
   1.642 +                T    dr = static_cast<T>(rhs.R_component_4());
   1.643 +                T    er = static_cast<T>(rhs.R_component_5());
   1.644 +                T    fr = static_cast<T>(rhs.R_component_6());
   1.645 +                T    gr = static_cast<T>(rhs.R_component_7());
   1.646 +                T    hr = static_cast<T>(rhs.R_component_8());
   1.647 +                
   1.648 +                T    denominator = ar*ar+br*br+cr*cr+dr*dr+er*er+fr*fr+gr*gr+hr*hr;
   1.649 +                
   1.650 +                T    at = (+a*ar+b*br+c*cr+d*dr+e*er+f*fr+g*gr+h*hr)/denominator;
   1.651 +                T    bt = (-a*br+b*ar-c*dr+d*cr-e*fr+f*er+g*hr-h*gr)/denominator;
   1.652 +                T    ct = (-a*cr+b*dr+c*ar-d*br-e*gr-f*hr+g*er+h*fr)/denominator;
   1.653 +                T    dt = (-a*dr-b*cr+c*br+d*ar-e*hr+f*gr-g*fr+h*er)/denominator;
   1.654 +                T    et = (-a*er+b*fr+c*gr+d*hr+e*ar-f*br-g*cr-h*dr)/denominator;
   1.655 +                T    ft = (-a*fr-b*er+c*hr-d*gr+e*br+f*ar+g*dr-h*cr)/denominator;
   1.656 +                T    gt = (-a*gr-b*hr-c*er+d*fr+e*cr-f*dr+g*ar+h*br)/denominator;
   1.657 +                T    ht = (-a*hr+b*gr-c*fr-d*er+e*dr+f*cr-g*br+h*ar)/denominator;
   1.658 +                
   1.659 +                a = at;
   1.660 +                b = bt;
   1.661 +                c = ct;
   1.662 +                d = dt;
   1.663 +                e = et;
   1.664 +                f = ft;
   1.665 +                g = gt;
   1.666 +                h = ht;
   1.667 +                
   1.668 +                return(*this);
   1.669 +            }
   1.670 +            
   1.671 +            
   1.672 +        protected:
   1.673 +            
   1.674 +            BOOST_OCTONION_MEMBER_DATA_GENERATOR(T)
   1.675 +            
   1.676 +            
   1.677 +        private:
   1.678 +            
   1.679 +        };
   1.680 +        
   1.681 +        
   1.682 +        // declaration of octonion specialization
   1.683 +        
   1.684 +        template<>    class octonion<float>;
   1.685 +        template<>    class octonion<double>;
   1.686 +        template<>    class octonion<long double>;
   1.687 +        
   1.688 +        
   1.689 +        // helper templates for converting copy constructors (declaration)
   1.690 +        
   1.691 +        namespace detail
   1.692 +        {
   1.693 +            
   1.694 +            template<   typename T,
   1.695 +                        typename U
   1.696 +                    >
   1.697 +            octonion<T>    octonion_type_converter(octonion<U> const & rhs);
   1.698 +        }
   1.699 +        
   1.700 +        
   1.701 +        // implementation of octonion specialization
   1.702 +        
   1.703 +        
   1.704 +#define    BOOST_OCTONION_CONSTRUCTOR_GENERATOR(type)                                                                               \
   1.705 +            explicit                    octonion(   type const & requested_a = static_cast<type>(0),                                \
   1.706 +                                                    type const & requested_b = static_cast<type>(0),                                \
   1.707 +                                                    type const & requested_c = static_cast<type>(0),                                \
   1.708 +                                                    type const & requested_d = static_cast<type>(0),                                \
   1.709 +                                                    type const & requested_e = static_cast<type>(0),                                \
   1.710 +                                                    type const & requested_f = static_cast<type>(0),                                \
   1.711 +                                                    type const & requested_g = static_cast<type>(0),                                \
   1.712 +                                                    type const & requested_h = static_cast<type>(0))                                \
   1.713 +            :   a(requested_a),                                                                                                     \
   1.714 +                b(requested_b),                                                                                                     \
   1.715 +                c(requested_c),                                                                                                     \
   1.716 +                d(requested_d),                                                                                                     \
   1.717 +                e(requested_e),                                                                                                     \
   1.718 +                f(requested_f),                                                                                                     \
   1.719 +                g(requested_g),                                                                                                     \
   1.720 +                h(requested_h)                                                                                                      \
   1.721 +            {                                                                                                                       \
   1.722 +            }                                                                                                                       \
   1.723 +                                                                                                                                    \
   1.724 +            explicit                    octonion(   ::std::complex<type> const & z0,                                                \
   1.725 +                                                    ::std::complex<type> const & z1 = ::std::complex<type>(),                       \
   1.726 +                                                    ::std::complex<type> const & z2 = ::std::complex<type>(),                       \
   1.727 +                                                    ::std::complex<type> const & z3 = ::std::complex<type>())                       \
   1.728 +            :   a(z0.real()),                                                                                                       \
   1.729 +                b(z0.imag()),                                                                                                       \
   1.730 +                c(z1.real()),                                                                                                       \
   1.731 +                d(z1.imag()),                                                                                                       \
   1.732 +                e(z2.real()),                                                                                                       \
   1.733 +                f(z2.imag()),                                                                                                       \
   1.734 +                g(z3.real()),                                                                                                       \
   1.735 +                h(z3.imag())                                                                                                        \
   1.736 +            {                                                                                                                       \
   1.737 +            }                                                                                                                       \
   1.738 +                                                                                                                                    \
   1.739 +            explicit                    octonion(   ::boost::math::quaternion<type> const & q0,                                     \
   1.740 +                                                    ::boost::math::quaternion<type> const & q1 = ::boost::math::quaternion<type>()) \
   1.741 +            :   a(q0.R_component_1()),                                                                                              \
   1.742 +                b(q0.R_component_2()),                                                                                              \
   1.743 +                c(q0.R_component_3()),                                                                                              \
   1.744 +                d(q0.R_component_4()),                                                                                              \
   1.745 +                e(q1.R_component_1()),                                                                                              \
   1.746 +                f(q1.R_component_2()),                                                                                              \
   1.747 +                g(q1.R_component_3()),                                                                                              \
   1.748 +                h(q1.R_component_4())                                                                                               \
   1.749 +            {                                                                                                                       \
   1.750 +            }
   1.751 +        
   1.752 +    
   1.753 +#define    BOOST_OCTONION_MEMBER_ADD_GENERATOR_1(type)                  \
   1.754 +            octonion<type> &            operator += (type const & rhs)  \
   1.755 +            {                                                           \
   1.756 +                a += rhs;                                               \
   1.757 +                                                                        \
   1.758 +                return(*this);                                          \
   1.759 +            }
   1.760 +    
   1.761 +#define    BOOST_OCTONION_MEMBER_ADD_GENERATOR_2(type)                                  \
   1.762 +            octonion<type> &            operator += (::std::complex<type> const & rhs)  \
   1.763 +            {                                                                           \
   1.764 +                a += rhs.real();                                                        \
   1.765 +                b += rhs.imag();                                                        \
   1.766 +                                                                                        \
   1.767 +                return(*this);                                                          \
   1.768 +            }
   1.769 +    
   1.770 +#define    BOOST_OCTONION_MEMBER_ADD_GENERATOR_3(type)                                              \
   1.771 +            octonion<type> &            operator += (::boost::math::quaternion<type> const & rhs)   \
   1.772 +            {                                                                                       \
   1.773 +                a += rhs.R_component_1();                                                           \
   1.774 +                b += rhs.R_component_2();                                                           \
   1.775 +                c += rhs.R_component_3();                                                           \
   1.776 +                d += rhs.R_component_4();                                                           \
   1.777 +                                                                                                    \
   1.778 +                return(*this);                                                                      \
   1.779 +            }
   1.780 +    
   1.781 +#define    BOOST_OCTONION_MEMBER_ADD_GENERATOR_4(type)                          \
   1.782 +            template<typename X>                                                \
   1.783 +            octonion<type> &            operator += (octonion<X> const & rhs)   \
   1.784 +            {                                                                   \
   1.785 +                a += static_cast<type>(rhs.R_component_1());                    \
   1.786 +                b += static_cast<type>(rhs.R_component_2());                    \
   1.787 +                c += static_cast<type>(rhs.R_component_3());                    \
   1.788 +                d += static_cast<type>(rhs.R_component_4());                    \
   1.789 +                e += static_cast<type>(rhs.R_component_5());                    \
   1.790 +                f += static_cast<type>(rhs.R_component_6());                    \
   1.791 +                g += static_cast<type>(rhs.R_component_7());                    \
   1.792 +                h += static_cast<type>(rhs.R_component_8());                    \
   1.793 +                                                                                \
   1.794 +                return(*this);                                                  \
   1.795 +            }
   1.796 +    
   1.797 +#define    BOOST_OCTONION_MEMBER_SUB_GENERATOR_1(type)                  \
   1.798 +            octonion<type> &            operator -= (type const & rhs)  \
   1.799 +            {                                                           \
   1.800 +                a -= rhs;                                               \
   1.801 +                                                                        \
   1.802 +                return(*this);                                          \
   1.803 +            }
   1.804 +    
   1.805 +#define    BOOST_OCTONION_MEMBER_SUB_GENERATOR_2(type)                                  \
   1.806 +            octonion<type> &            operator -= (::std::complex<type> const & rhs)  \
   1.807 +            {                                                                           \
   1.808 +                a -= rhs.real();                                                        \
   1.809 +                b -= rhs.imag();                                                        \
   1.810 +                                                                                        \
   1.811 +                return(*this);                                                          \
   1.812 +            }
   1.813 +    
   1.814 +#define    BOOST_OCTONION_MEMBER_SUB_GENERATOR_3(type)                                              \
   1.815 +            octonion<type> &            operator -= (::boost::math::quaternion<type> const & rhs)   \
   1.816 +            {                                                                                       \
   1.817 +                a -= rhs.R_component_1();                                                           \
   1.818 +                b -= rhs.R_component_2();                                                           \
   1.819 +                c -= rhs.R_component_3();                                                           \
   1.820 +                d -= rhs.R_component_4();                                                           \
   1.821 +                                                                                                    \
   1.822 +                return(*this);                                                                      \
   1.823 +            }
   1.824 +    
   1.825 +#define    BOOST_OCTONION_MEMBER_SUB_GENERATOR_4(type)                        \
   1.826 +            template<typename X>                                              \
   1.827 +            octonion<type> &            operator -= (octonion<X> const & rhs) \
   1.828 +            {                                                                 \
   1.829 +                a -= static_cast<type>(rhs.R_component_1());                  \
   1.830 +                b -= static_cast<type>(rhs.R_component_2());                  \
   1.831 +                c -= static_cast<type>(rhs.R_component_3());                  \
   1.832 +                d -= static_cast<type>(rhs.R_component_4());                  \
   1.833 +                e -= static_cast<type>(rhs.R_component_5());                  \
   1.834 +                f -= static_cast<type>(rhs.R_component_6());                  \
   1.835 +                g -= static_cast<type>(rhs.R_component_7());                  \
   1.836 +                h -= static_cast<type>(rhs.R_component_8());                  \
   1.837 +                                                                              \
   1.838 +                return(*this);                                                \
   1.839 +            }
   1.840 +    
   1.841 +#define    BOOST_OCTONION_MEMBER_MUL_GENERATOR_1(type)                   \
   1.842 +            octonion<type> &            operator *= (type const & rhs)   \
   1.843 +            {                                                            \
   1.844 +                a *= rhs;                                                \
   1.845 +                b *= rhs;                                                \
   1.846 +                c *= rhs;                                                \
   1.847 +                d *= rhs;                                                \
   1.848 +                e *= rhs;                                                \
   1.849 +                f *= rhs;                                                \
   1.850 +                g *= rhs;                                                \
   1.851 +                h *= rhs;                                                \
   1.852 +                                                                         \
   1.853 +                return(*this);                                           \
   1.854 +            }
   1.855 +    
   1.856 +#define    BOOST_OCTONION_MEMBER_MUL_GENERATOR_2(type)                                  \
   1.857 +            octonion<type> &            operator *= (::std::complex<type> const & rhs)  \
   1.858 +            {                                                                           \
   1.859 +                type    ar = rhs.real();                                                \
   1.860 +                type    br = rhs.imag();                                                \
   1.861 +                                                                                        \
   1.862 +                type    at = +a*ar-b*br;                                                \
   1.863 +                type    bt = +a*br+b*ar;                                                \
   1.864 +                type    ct = +c*ar+d*br;                                                \
   1.865 +                type    dt = -c*br+d*ar;                                                \
   1.866 +                type    et = +e*ar+f*br;                                                \
   1.867 +                type    ft = -e*br+f*ar;                                                \
   1.868 +                type    gt = +g*ar-h*br;                                                \
   1.869 +                type    ht = +g*br+h*ar;                                                \
   1.870 +                                                                                        \
   1.871 +                a = at;                                                                 \
   1.872 +                b = bt;                                                                 \
   1.873 +                c = ct;                                                                 \
   1.874 +                d = dt;                                                                 \
   1.875 +                e = et;                                                                 \
   1.876 +                f = ft;                                                                 \
   1.877 +                g = gt;                                                                 \
   1.878 +                h = ht;                                                                 \
   1.879 +                                                                                        \
   1.880 +                return(*this);                                                          \
   1.881 +            }
   1.882 +    
   1.883 +#define    BOOST_OCTONION_MEMBER_MUL_GENERATOR_3(type)                                                    \
   1.884 +            octonion<type> &            operator *= (::boost::math::quaternion<type> const & rhs)   \
   1.885 +            {                                                                                       \
   1.886 +                type    ar = rhs.R_component_1();                                                   \
   1.887 +                type    br = rhs.R_component_2();                                                   \
   1.888 +                type    cr = rhs.R_component_2();                                                   \
   1.889 +                type    dr = rhs.R_component_2();                                                   \
   1.890 +                                                                                                    \
   1.891 +                type    at = +a*ar-b*br-c*cr-d*dr;                                                  \
   1.892 +                type    bt = +a*br+b*ar+c*dr-d*cr;                                                  \
   1.893 +                type    ct = +a*cr-b*dr+c*ar+d*br;                                                  \
   1.894 +                type    dt = +a*dr+b*cr-c*br+d*ar;                                                  \
   1.895 +                type    et = +e*ar+f*br+g*cr+h*dr;                                                  \
   1.896 +                type    ft = -e*br+f*ar-g*dr+h*cr;                                                  \
   1.897 +                type    gt = -e*cr+f*dr+g*ar-h*br;                                                  \
   1.898 +                type    ht = -e*dr-f*cr+g*br+h*ar;                                                  \
   1.899 +                                                                                                    \
   1.900 +                a = at;                                                                             \
   1.901 +                b = bt;                                                                             \
   1.902 +                c = ct;                                                                             \
   1.903 +                d = dt;                                                                             \
   1.904 +                e = et;                                                                             \
   1.905 +                f = ft;                                                                             \
   1.906 +                g = gt;                                                                             \
   1.907 +                h = ht;                                                                             \
   1.908 +                                                                                                    \
   1.909 +                return(*this);                                                                      \
   1.910 +            }
   1.911 +    
   1.912 +#define    BOOST_OCTONION_MEMBER_MUL_GENERATOR_4(type)                          \
   1.913 +            template<typename X>                                                \
   1.914 +            octonion<type> &            operator *= (octonion<X> const & rhs)   \
   1.915 +            {                                                                   \
   1.916 +                type    ar = static_cast<type>(rhs.R_component_1());            \
   1.917 +                type    br = static_cast<type>(rhs.R_component_2());            \
   1.918 +                type    cr = static_cast<type>(rhs.R_component_3());            \
   1.919 +                type    dr = static_cast<type>(rhs.R_component_4());            \
   1.920 +                type    er = static_cast<type>(rhs.R_component_5());            \
   1.921 +                type    fr = static_cast<type>(rhs.R_component_6());            \
   1.922 +                type    gr = static_cast<type>(rhs.R_component_7());            \
   1.923 +                type    hr = static_cast<type>(rhs.R_component_8());            \
   1.924 +                                                                                \
   1.925 +                type    at = +a*ar-b*br-c*cr-d*dr-e*er-f*fr-g*gr-h*hr;          \
   1.926 +                type    bt = +a*br+b*ar+c*dr-d*cr+e*fr-f*er-g*hr+h*gr;          \
   1.927 +                type    ct = +a*cr-b*dr+c*ar+d*br+e*gr+f*hr-g*er-h*fr;          \
   1.928 +                type    dt = +a*dr+b*cr-c*br+d*ar+e*hr-f*gr+g*fr-h*er;          \
   1.929 +                type    et = +a*er-b*fr-c*gr-d*hr+e*ar+f*br+g*cr+h*dr;          \
   1.930 +                type    ft = +a*fr+b*er-c*hr+d*gr-e*br+f*ar-g*dr+h*cr;          \
   1.931 +                type    gt = +a*gr+b*hr+c*er-d*fr-e*cr+f*dr+g*ar-h*br;          \
   1.932 +                type    ht = +a*hr-b*gr+c*fr+d*er-e*dr-f*cr+g*br+h*ar;          \
   1.933 +                                                                                \
   1.934 +                a = at;                                                         \
   1.935 +                b = bt;                                                         \
   1.936 +                c = ct;                                                         \
   1.937 +                d = dt;                                                         \
   1.938 +                e = et;                                                         \
   1.939 +                f = ft;                                                         \
   1.940 +                g = gt;                                                         \
   1.941 +                h = ht;                                                         \
   1.942 +                                                                                \
   1.943 +                return(*this);                                                  \
   1.944 +            }
   1.945 +    
   1.946 +// There is quite a lot of repetition in the code below. This is intentional.
   1.947 +// The last conditional block is the normal form, and the others merely
   1.948 +// consist of workarounds for various compiler deficiencies. Hopefuly, when
   1.949 +// more compilers are conformant and we can retire support for those that are
   1.950 +// not, we will be able to remove the clutter. This is makes the situation
   1.951 +// (painfully) explicit.
   1.952 +    
   1.953 +#define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_1(type)                  \
   1.954 +            octonion<type> &            operator /= (type const & rhs)  \
   1.955 +            {                                                           \
   1.956 +                a /= rhs;                                               \
   1.957 +                b /= rhs;                                               \
   1.958 +                c /= rhs;                                               \
   1.959 +                d /= rhs;                                               \
   1.960 +                                                                        \
   1.961 +                return(*this);                                          \
   1.962 +            }
   1.963 +    
   1.964 +#if defined(__GNUC__) && (__GNUC__ < 3)
   1.965 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_2(type)                                              \
   1.966 +            octonion<type> &            operator /= (::std::complex<type> const & rhs)                  \
   1.967 +            {                                                                                           \
   1.968 +                using    ::std::valarray;                                                               \
   1.969 +                                                                                                        \
   1.970 +                valarray<type>    tr(2);                                                                \
   1.971 +                                                                                                        \
   1.972 +                tr[0] = rhs.real();                                                                     \
   1.973 +                tr[1] = rhs.imag();                                                                     \
   1.974 +                                                                                                        \
   1.975 +                type            mixam = (BOOST_GET_VALARRAY(type,static_cast<type>(1)/abs(tr)).max)();  \
   1.976 +                                                                                                        \
   1.977 +                tr *= mixam;                                                                            \
   1.978 +                                                                                                        \
   1.979 +                valarray<type>    tt(8);                                                                \
   1.980 +                                                                                                        \
   1.981 +                tt[0] = +a*tr[0]-b*tr[1];                                                               \
   1.982 +                tt[1] = -a*tr[1]+b*tr[0];                                                               \
   1.983 +                tt[2] = +c*tr[0]-d*tr[1];                                                               \
   1.984 +                tt[3] = +c*tr[1]+d*tr[0];                                                               \
   1.985 +                tt[4] = +e*tr[0]-f*tr[1];                                                               \
   1.986 +                tt[5] = +e*tr[1]+f*tr[0];                                                               \
   1.987 +                tt[6] = +g*tr[0]+h*tr[1];                                                               \
   1.988 +                tt[7] = +g*tr[1]+h*tr[0];                                                               \
   1.989 +                                                                                                        \
   1.990 +                tr *= tr;                                                                               \
   1.991 +                                                                                                        \
   1.992 +                tt *= (mixam/tr.sum());                                                                 \
   1.993 +                                                                                                        \
   1.994 +                a = tt[0];                                                                              \
   1.995 +                b = tt[1];                                                                              \
   1.996 +                c = tt[2];                                                                              \
   1.997 +                d = tt[3];                                                                              \
   1.998 +                e = tt[4];                                                                              \
   1.999 +                f = tt[5];                                                                              \
  1.1000 +                g = tt[6];                                                                              \
  1.1001 +                h = tt[7];                                                                              \
  1.1002 +                                                                                                        \
  1.1003 +                return(*this);                                                                          \
  1.1004 +            }
  1.1005 +#elif    defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
  1.1006 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_2(type)                              \
  1.1007 +            octonion<type> &            operator /= (::std::complex<type> const & rhs)  \
  1.1008 +            {                                                                           \
  1.1009 +                using    ::std::valarray;                                               \
  1.1010 +                using    ::std::abs;                                                    \
  1.1011 +                                                                                        \
  1.1012 +                valarray<type>    tr(2);                                                \
  1.1013 +                                                                                        \
  1.1014 +                tr[0] = rhs.real();                                                     \
  1.1015 +                tr[1] = rhs.imag();                                                     \
  1.1016 +                                                                                        \
  1.1017 +                type            mixam = static_cast<type>(1)/(abs(tr).max)();           \
  1.1018 +                                                                                        \
  1.1019 +                tr *= mixam;                                                            \
  1.1020 +                                                                                        \
  1.1021 +                valarray<type>    tt(8);                                                \
  1.1022 +                                                                                        \
  1.1023 +                tt[0] = +a*tr[0]-b*tr[1];                                               \
  1.1024 +                tt[1] = -a*tr[1]+b*tr[0];                                               \
  1.1025 +                tt[2] = +c*tr[0]-d*tr[1];                                               \
  1.1026 +                tt[3] = +c*tr[1]+d*tr[0];                                               \
  1.1027 +                tt[4] = +e*tr[0]-f*tr[1];                                               \
  1.1028 +                tt[5] = +e*tr[1]+f*tr[0];                                               \
  1.1029 +                tt[6] = +g*tr[0]+h*tr[1];                                               \
  1.1030 +                tt[7] = +g*tr[1]+h*tr[0];                                               \
  1.1031 +                                                                                        \
  1.1032 +                tr *= tr;                                                               \
  1.1033 +                                                                                        \
  1.1034 +                tt *= (mixam/tr.sum());                                                 \
  1.1035 +                                                                                        \
  1.1036 +                a = tt[0];                                                              \
  1.1037 +                b = tt[1];                                                              \
  1.1038 +                c = tt[2];                                                              \
  1.1039 +                d = tt[3];                                                              \
  1.1040 +                e = tt[4];                                                              \
  1.1041 +                f = tt[5];                                                              \
  1.1042 +                g = tt[6];                                                              \
  1.1043 +                h = tt[7];                                                              \
  1.1044 +                                                                                        \
  1.1045 +                return(*this);                                                          \
  1.1046 +            }
  1.1047 +#else
  1.1048 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_2(type)                              \
  1.1049 +            octonion<type> &            operator /= (::std::complex<type> const & rhs)  \
  1.1050 +            {                                                                           \
  1.1051 +                using    ::std::valarray;                                               \
  1.1052 +                                                                                        \
  1.1053 +                valarray<type>    tr(2);                                                \
  1.1054 +                                                                                        \
  1.1055 +                tr[0] = rhs.real();                                                     \
  1.1056 +                tr[1] = rhs.imag();                                                     \
  1.1057 +                                                                                        \
  1.1058 +                type            mixam = static_cast<type>(1)/(abs(tr).max)();           \
  1.1059 +                                                                                        \
  1.1060 +                tr *= mixam;                                                            \
  1.1061 +                                                                                        \
  1.1062 +                valarray<type>    tt(8);                                                \
  1.1063 +                                                                                        \
  1.1064 +                tt[0] = +a*tr[0]-b*tr[1];                                               \
  1.1065 +                tt[1] = -a*tr[1]+b*tr[0];                                               \
  1.1066 +                tt[2] = +c*tr[0]-d*tr[1];                                               \
  1.1067 +                tt[3] = +c*tr[1]+d*tr[0];                                               \
  1.1068 +                tt[4] = +e*tr[0]-f*tr[1];                                               \
  1.1069 +                tt[5] = +e*tr[1]+f*tr[0];                                               \
  1.1070 +                tt[6] = +g*tr[0]+h*tr[1];                                               \
  1.1071 +                tt[7] = +g*tr[1]+h*tr[0];                                               \
  1.1072 +                                                                                        \
  1.1073 +                tr *= tr;                                                               \
  1.1074 +                                                                                        \
  1.1075 +                tt *= (mixam/tr.sum());                                                 \
  1.1076 +                                                                                        \
  1.1077 +                a = tt[0];                                                              \
  1.1078 +                b = tt[1];                                                              \
  1.1079 +                c = tt[2];                                                              \
  1.1080 +                d = tt[3];                                                              \
  1.1081 +                e = tt[4];                                                              \
  1.1082 +                f = tt[5];                                                              \
  1.1083 +                g = tt[6];                                                              \
  1.1084 +                h = tt[7];                                                              \
  1.1085 +                                                                                        \
  1.1086 +                return(*this);                                                          \
  1.1087 +            }
  1.1088 +#endif    /* defined(__GNUC__) && (__GNUC__ < 3) */ /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */
  1.1089 +    
  1.1090 +#if defined(__GNUC__) && (__GNUC__ < 3)
  1.1091 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_3(type)                                           \
  1.1092 +            octonion<type> &            operator /= (::boost::math::quaternion<type> const & rhs)    \
  1.1093 +            {                                                                                        \
  1.1094 +                using    ::std::valarray;                                                            \
  1.1095 +                                                                                                     \
  1.1096 +                valarray<type>    tr(4);                                                             \
  1.1097 +                                                                                                     \
  1.1098 +                tr[0] = static_cast<type>(rhs.R_component_1());                                      \
  1.1099 +                tr[1] = static_cast<type>(rhs.R_component_2());                                      \
  1.1100 +                tr[2] = static_cast<type>(rhs.R_component_3());                                      \
  1.1101 +                tr[3] = static_cast<type>(rhs.R_component_4());                                      \
  1.1102 +                                                                                                     \
  1.1103 +                type           mixam = (BOOST_GET_VALARRAY(type,static_cast<type>(1)/abs(tr)).max)();\
  1.1104 +                                                                                                     \
  1.1105 +                tr *= mixam;                                                                         \
  1.1106 +                                                                                                     \
  1.1107 +                valarray<type>    tt(8);                                                             \
  1.1108 +                                                                                                     \
  1.1109 +                tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3];                                            \
  1.1110 +                tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2];                                            \
  1.1111 +                tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1];                                            \
  1.1112 +                tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0];                                            \
  1.1113 +                tt[4] = +e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3];                                            \
  1.1114 +                tt[5] = +e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2];                                            \
  1.1115 +                tt[6] = +e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1];                                            \
  1.1116 +                tt[7] = +e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0];                                            \
  1.1117 +                                                                                                     \
  1.1118 +                tr *= tr;                                                                            \
  1.1119 +                                                                                                     \
  1.1120 +                tt *= (mixam/tr.sum());                                                              \
  1.1121 +                                                                                                     \
  1.1122 +                a = tt[0];                                                                           \
  1.1123 +                b = tt[1];                                                                           \
  1.1124 +                c = tt[2];                                                                           \
  1.1125 +                d = tt[3];                                                                           \
  1.1126 +                e = tt[4];                                                                           \
  1.1127 +                f = tt[5];                                                                           \
  1.1128 +                g = tt[6];                                                                           \
  1.1129 +                h = tt[7];                                                                           \
  1.1130 +                                                                                                     \
  1.1131 +                return(*this);                                                                       \
  1.1132 +            }
  1.1133 +#elif    defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
  1.1134 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_3(type)                                           \
  1.1135 +            octonion<type> &            operator /= (::boost::math::quaternion<type> const & rhs)    \
  1.1136 +            {                                                                                        \
  1.1137 +                using    ::std::valarray;                                                            \
  1.1138 +                using    ::std::abs;                                                                 \
  1.1139 +                                                                                                     \
  1.1140 +                valarray<type>    tr(4);                                                             \
  1.1141 +                                                                                                     \
  1.1142 +                tr[0] = static_cast<type>(rhs.R_component_1());                                      \
  1.1143 +                tr[1] = static_cast<type>(rhs.R_component_2());                                      \
  1.1144 +                tr[2] = static_cast<type>(rhs.R_component_3());                                      \
  1.1145 +                tr[3] = static_cast<type>(rhs.R_component_4());                                      \
  1.1146 +                                                                                                     \
  1.1147 +                type            mixam = static_cast<type>(1)/(abs(tr).max)();                        \
  1.1148 +                                                                                                     \
  1.1149 +                tr *= mixam;                                                                         \
  1.1150 +                                                                                                     \
  1.1151 +                valarray<type>    tt(8);                                                             \
  1.1152 +                                                                                                     \
  1.1153 +                tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3];                                            \
  1.1154 +                tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2];                                            \
  1.1155 +                tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1];                                            \
  1.1156 +                tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0];                                            \
  1.1157 +                tt[4] = +e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3];                                            \
  1.1158 +                tt[5] = +e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2];                                            \
  1.1159 +                tt[6] = +e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1];                                            \
  1.1160 +                tt[7] = +e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0];                                            \
  1.1161 +                                                                                                     \
  1.1162 +                tr *= tr;                                                                            \
  1.1163 +                                                                                                     \
  1.1164 +                tt *= (mixam/tr.sum());                                                              \
  1.1165 +                                                                                                     \
  1.1166 +                a = tt[0];                                                                           \
  1.1167 +                b = tt[1];                                                                           \
  1.1168 +                c = tt[2];                                                                           \
  1.1169 +                d = tt[3];                                                                           \
  1.1170 +                e = tt[4];                                                                           \
  1.1171 +                f = tt[5];                                                                           \
  1.1172 +                g = tt[6];                                                                           \
  1.1173 +                h = tt[7];                                                                           \
  1.1174 +                                                                                                     \
  1.1175 +                return(*this);                                                                       \
  1.1176 +            }
  1.1177 +#else
  1.1178 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_3(type)                                           \
  1.1179 +            octonion<type> &            operator /= (::boost::math::quaternion<type> const & rhs)    \
  1.1180 +            {                                                                                        \
  1.1181 +                using    ::std::valarray;                                                            \
  1.1182 +                                                                                                     \
  1.1183 +                valarray<type>    tr(4);                                                             \
  1.1184 +                                                                                                     \
  1.1185 +                tr[0] = static_cast<type>(rhs.R_component_1());                                      \
  1.1186 +                tr[1] = static_cast<type>(rhs.R_component_2());                                      \
  1.1187 +                tr[2] = static_cast<type>(rhs.R_component_3());                                      \
  1.1188 +                tr[3] = static_cast<type>(rhs.R_component_4());                                      \
  1.1189 +                                                                                                     \
  1.1190 +                type            mixam = static_cast<type>(1)/(abs(tr).max)();                        \
  1.1191 +                                                                                                     \
  1.1192 +                tr *= mixam;                                                                         \
  1.1193 +                                                                                                     \
  1.1194 +                valarray<type>    tt(8);                                                             \
  1.1195 +                                                                                                     \
  1.1196 +                tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3];                                            \
  1.1197 +                tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2];                                            \
  1.1198 +                tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1];                                            \
  1.1199 +                tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0];                                            \
  1.1200 +                tt[4] = +e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3];                                            \
  1.1201 +                tt[5] = +e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2];                                            \
  1.1202 +                tt[6] = +e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1];                                            \
  1.1203 +                tt[7] = +e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0];                                            \
  1.1204 +                                                                                                     \
  1.1205 +                tr *= tr;                                                                            \
  1.1206 +                                                                                                     \
  1.1207 +                tt *= (mixam/tr.sum());                                                              \
  1.1208 +                                                                                                     \
  1.1209 +                a = tt[0];                                                                           \
  1.1210 +                b = tt[1];                                                                           \
  1.1211 +                c = tt[2];                                                                           \
  1.1212 +                d = tt[3];                                                                           \
  1.1213 +                e = tt[4];                                                                           \
  1.1214 +                f = tt[5];                                                                           \
  1.1215 +                g = tt[6];                                                                           \
  1.1216 +                h = tt[7];                                                                           \
  1.1217 +                                                                                                     \
  1.1218 +                return(*this);                                                                       \
  1.1219 +            }
  1.1220 +#endif    /* defined(__GNUC__) && (__GNUC__ < 3) */ /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */
  1.1221 +    
  1.1222 +#if defined(__GNUC__) && (__GNUC__ < 3)
  1.1223 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_4(type)                                           \
  1.1224 +            template<typename X>                                                                     \
  1.1225 +            octonion<type> &            operator /= (octonion<X> const & rhs)                        \
  1.1226 +            {                                                                                        \
  1.1227 +                using    ::std::valarray;                                                            \
  1.1228 +                                                                                                     \
  1.1229 +                valarray<type>    tr(8);                                                             \
  1.1230 +                                                                                                     \
  1.1231 +                tr[0] = static_cast<type>(rhs.R_component_1());                                      \
  1.1232 +                tr[1] = static_cast<type>(rhs.R_component_2());                                      \
  1.1233 +                tr[2] = static_cast<type>(rhs.R_component_3());                                      \
  1.1234 +                tr[3] = static_cast<type>(rhs.R_component_4());                                      \
  1.1235 +                tr[4] = static_cast<type>(rhs.R_component_5());                                      \
  1.1236 +                tr[5] = static_cast<type>(rhs.R_component_6());                                      \
  1.1237 +                tr[6] = static_cast<type>(rhs.R_component_7());                                      \
  1.1238 +                tr[7] = static_cast<type>(rhs.R_component_8());                                      \
  1.1239 +                                                                                                     \
  1.1240 +                type           mixam = (BOOST_GET_VALARRAY(type,static_cast<type>(1)/abs(tr)).max)();\
  1.1241 +                                                                                                     \
  1.1242 +                tr *= mixam;                                                                         \
  1.1243 +                                                                                                     \
  1.1244 +                valarray<type>    tt(8);                                                             \
  1.1245 +                                                                                                     \
  1.1246 +                tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3]+e*tr[4]+f*tr[5]+g*tr[6]+h*tr[7];            \
  1.1247 +                tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2]-e*tr[5]+f*tr[4]+g*tr[7]-h*tr[6];            \
  1.1248 +                tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1]-e*tr[6]-f*tr[7]+g*tr[4]+h*tr[5];            \
  1.1249 +                tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0]-e*tr[7]+f*tr[6]-g*tr[5]+h*tr[4];            \
  1.1250 +                tt[4] = -a*tr[4]+b*tr[5]+c*tr[6]+d*tr[7]+e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3];            \
  1.1251 +                tt[5] = -a*tr[5]-b*tr[4]+c*tr[7]-d*tr[6]+e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2];            \
  1.1252 +                tt[6] = -a*tr[6]-b*tr[7]-c*tr[4]+d*tr[5]+e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1];            \
  1.1253 +                tt[7] = -a*tr[7]+b*tr[6]-c*tr[5]-d*tr[4]+e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0];            \
  1.1254 +                                                                                                     \
  1.1255 +                tr *= tr;                                                                            \
  1.1256 +                                                                                                     \
  1.1257 +                tt *= (mixam/tr.sum());                                                              \
  1.1258 +                                                                                                     \
  1.1259 +                a = tt[0];                                                                           \
  1.1260 +                b = tt[1];                                                                           \
  1.1261 +                c = tt[2];                                                                           \
  1.1262 +                d = tt[3];                                                                           \
  1.1263 +                e = tt[4];                                                                           \
  1.1264 +                f = tt[5];                                                                           \
  1.1265 +                g = tt[6];                                                                           \
  1.1266 +                h = tt[7];                                                                           \
  1.1267 +                                                                                                     \
  1.1268 +                return(*this);                                                                       \
  1.1269 +            }
  1.1270 +#elif    defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
  1.1271 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_4(type)                                           \
  1.1272 +            template<typename X>                                                                     \
  1.1273 +            octonion<type> &            operator /= (octonion<X> const & rhs)                        \
  1.1274 +            {                                                                                        \
  1.1275 +                using    ::std::valarray;                                                            \
  1.1276 +                using    ::std::abs;                                                                 \
  1.1277 +                                                                                                     \
  1.1278 +                valarray<type>    tr(8);                                                             \
  1.1279 +                                                                                                     \
  1.1280 +                tr[0] = static_cast<type>(rhs.R_component_1());                                      \
  1.1281 +                tr[1] = static_cast<type>(rhs.R_component_2());                                      \
  1.1282 +                tr[2] = static_cast<type>(rhs.R_component_3());                                      \
  1.1283 +                tr[3] = static_cast<type>(rhs.R_component_4());                                      \
  1.1284 +                tr[4] = static_cast<type>(rhs.R_component_5());                                      \
  1.1285 +                tr[5] = static_cast<type>(rhs.R_component_6());                                      \
  1.1286 +                tr[6] = static_cast<type>(rhs.R_component_7());                                      \
  1.1287 +                tr[7] = static_cast<type>(rhs.R_component_8());                                      \
  1.1288 +                                                                                                     \
  1.1289 +                type            mixam = static_cast<type>(1)/(abs(tr).max)();                        \
  1.1290 +                                                                                                     \
  1.1291 +                tr *= mixam;                                                                         \
  1.1292 +                                                                                                     \
  1.1293 +                valarray<type>    tt(8);                                                             \
  1.1294 +                                                                                                     \
  1.1295 +                tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3]+e*tr[4]+f*tr[5]+g*tr[6]+h*tr[7];            \
  1.1296 +                tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2]-e*tr[5]+f*tr[4]+g*tr[7]-h*tr[6];            \
  1.1297 +                tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1]-e*tr[6]-f*tr[7]+g*tr[4]+h*tr[5];            \
  1.1298 +                tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0]-e*tr[7]+f*tr[6]-g*tr[5]+h*tr[4];            \
  1.1299 +                tt[4] = -a*tr[4]+b*tr[5]+c*tr[6]+d*tr[7]+e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3];            \
  1.1300 +                tt[5] = -a*tr[5]-b*tr[4]+c*tr[7]-d*tr[6]+e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2];            \
  1.1301 +                tt[6] = -a*tr[6]-b*tr[7]-c*tr[4]+d*tr[5]+e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1];            \
  1.1302 +                tt[7] = -a*tr[7]+b*tr[6]-c*tr[5]-d*tr[4]+e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0];            \
  1.1303 +                                                                                                     \
  1.1304 +                tr *= tr;                                                                            \
  1.1305 +                                                                                                     \
  1.1306 +                tt *= (mixam/tr.sum());                                                              \
  1.1307 +                                                                                                     \
  1.1308 +                a = tt[0];                                                                           \
  1.1309 +                b = tt[1];                                                                           \
  1.1310 +                c = tt[2];                                                                           \
  1.1311 +                d = tt[3];                                                                           \
  1.1312 +                e = tt[4];                                                                           \
  1.1313 +                f = tt[5];                                                                           \
  1.1314 +                g = tt[6];                                                                           \
  1.1315 +                h = tt[7];                                                                           \
  1.1316 +                                                                                                     \
  1.1317 +                return(*this);                                                                       \
  1.1318 +            }
  1.1319 +#else
  1.1320 +    #define    BOOST_OCTONION_MEMBER_DIV_GENERATOR_4(type)                                           \
  1.1321 +            template<typename X>                                                                     \
  1.1322 +            octonion<type> &            operator /= (octonion<X> const & rhs)                        \
  1.1323 +            {                                                                                        \
  1.1324 +                using    ::std::valarray;                                                            \
  1.1325 +                                                                                                     \
  1.1326 +                valarray<type>    tr(8);                                                             \
  1.1327 +                                                                                                     \
  1.1328 +                tr[0] = static_cast<type>(rhs.R_component_1());                                      \
  1.1329 +                tr[1] = static_cast<type>(rhs.R_component_2());                                      \
  1.1330 +                tr[2] = static_cast<type>(rhs.R_component_3());                                      \
  1.1331 +                tr[3] = static_cast<type>(rhs.R_component_4());                                      \
  1.1332 +                tr[4] = static_cast<type>(rhs.R_component_5());                                      \
  1.1333 +                tr[5] = static_cast<type>(rhs.R_component_6());                                      \
  1.1334 +                tr[6] = static_cast<type>(rhs.R_component_7());                                      \
  1.1335 +                tr[7] = static_cast<type>(rhs.R_component_8());                                      \
  1.1336 +                                                                                                     \
  1.1337 +                type            mixam = static_cast<type>(1)/(abs(tr).max)();                        \
  1.1338 +                                                                                                     \
  1.1339 +                tr *= mixam;                                                                         \
  1.1340 +                                                                                                     \
  1.1341 +                valarray<type>    tt(8);                                                             \
  1.1342 +                                                                                                     \
  1.1343 +                tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3]+e*tr[4]+f*tr[5]+g*tr[6]+h*tr[7];            \
  1.1344 +                tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2]-e*tr[5]+f*tr[4]+g*tr[7]-h*tr[6];            \
  1.1345 +                tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1]-e*tr[6]-f*tr[7]+g*tr[4]+h*tr[5];            \
  1.1346 +                tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0]-e*tr[7]+f*tr[6]-g*tr[5]+h*tr[4];            \
  1.1347 +                tt[4] = -a*tr[4]+b*tr[5]+c*tr[6]+d*tr[7]+e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3];            \
  1.1348 +                tt[5] = -a*tr[5]-b*tr[4]+c*tr[7]-d*tr[6]+e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2];            \
  1.1349 +                tt[6] = -a*tr[6]-b*tr[7]-c*tr[4]+d*tr[5]+e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1];            \
  1.1350 +                tt[7] = -a*tr[7]+b*tr[6]-c*tr[5]-d*tr[4]+e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0];            \
  1.1351 +                                                                                                     \
  1.1352 +                tr *= tr;                                                                            \
  1.1353 +                                                                                                     \
  1.1354 +                tt *= (mixam/tr.sum());                                                              \
  1.1355 +                                                                                                     \
  1.1356 +                a = tt[0];                                                                           \
  1.1357 +                b = tt[1];                                                                           \
  1.1358 +                c = tt[2];                                                                           \
  1.1359 +                d = tt[3];                                                                           \
  1.1360 +                e = tt[4];                                                                           \
  1.1361 +                f = tt[5];                                                                           \
  1.1362 +                g = tt[6];                                                                           \
  1.1363 +                h = tt[7];                                                                           \
  1.1364 +                                                                                                     \
  1.1365 +                return(*this);                                                                       \
  1.1366 +            }
  1.1367 +#endif    /* defined(__GNUC__) && (__GNUC__ < 3) */ /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */
  1.1368 +    
  1.1369 +    
  1.1370 +#define    BOOST_OCTONION_MEMBER_ADD_GENERATOR(type)       \
  1.1371 +        BOOST_OCTONION_MEMBER_ADD_GENERATOR_1(type)        \
  1.1372 +        BOOST_OCTONION_MEMBER_ADD_GENERATOR_2(type)        \
  1.1373 +        BOOST_OCTONION_MEMBER_ADD_GENERATOR_3(type)        \
  1.1374 +        BOOST_OCTONION_MEMBER_ADD_GENERATOR_4(type)
  1.1375 +        
  1.1376 +#define    BOOST_OCTONION_MEMBER_SUB_GENERATOR(type)       \
  1.1377 +        BOOST_OCTONION_MEMBER_SUB_GENERATOR_1(type)        \
  1.1378 +        BOOST_OCTONION_MEMBER_SUB_GENERATOR_2(type)        \
  1.1379 +        BOOST_OCTONION_MEMBER_SUB_GENERATOR_3(type)        \
  1.1380 +        BOOST_OCTONION_MEMBER_SUB_GENERATOR_4(type)
  1.1381 +        
  1.1382 +#define    BOOST_OCTONION_MEMBER_MUL_GENERATOR(type)       \
  1.1383 +        BOOST_OCTONION_MEMBER_MUL_GENERATOR_1(type)        \
  1.1384 +        BOOST_OCTONION_MEMBER_MUL_GENERATOR_2(type)        \
  1.1385 +        BOOST_OCTONION_MEMBER_MUL_GENERATOR_3(type)        \
  1.1386 +        BOOST_OCTONION_MEMBER_MUL_GENERATOR_4(type)
  1.1387 +        
  1.1388 +#define    BOOST_OCTONION_MEMBER_DIV_GENERATOR(type)       \
  1.1389 +        BOOST_OCTONION_MEMBER_DIV_GENERATOR_1(type)        \
  1.1390 +        BOOST_OCTONION_MEMBER_DIV_GENERATOR_2(type)        \
  1.1391 +        BOOST_OCTONION_MEMBER_DIV_GENERATOR_3(type)        \
  1.1392 +        BOOST_OCTONION_MEMBER_DIV_GENERATOR_4(type)
  1.1393 +        
  1.1394 +#define    BOOST_OCTONION_MEMBER_ALGEBRAIC_GENERATOR(type) \
  1.1395 +        BOOST_OCTONION_MEMBER_ADD_GENERATOR(type)          \
  1.1396 +        BOOST_OCTONION_MEMBER_SUB_GENERATOR(type)          \
  1.1397 +        BOOST_OCTONION_MEMBER_MUL_GENERATOR(type)          \
  1.1398 +        BOOST_OCTONION_MEMBER_DIV_GENERATOR(type)
  1.1399 +        
  1.1400 +        
  1.1401 +        template<>
  1.1402 +        class octonion<float>
  1.1403 +        {
  1.1404 +        public:
  1.1405 +            
  1.1406 +            typedef float value_type;
  1.1407 +            
  1.1408 +            BOOST_OCTONION_CONSTRUCTOR_GENERATOR(float)
  1.1409 +            
  1.1410 +            // UNtemplated copy constructor
  1.1411 +            // (this is taken care of by the compiler itself)
  1.1412 +            
  1.1413 +            // explicit copy constructors (precision-loosing converters)
  1.1414 +            
  1.1415 +            explicit                    octonion(octonion<double> const & a_recopier)
  1.1416 +            {
  1.1417 +                *this = detail::octonion_type_converter<float, double>(a_recopier);
  1.1418 +            }
  1.1419 +            
  1.1420 +            explicit                    octonion(octonion<long double> const & a_recopier)
  1.1421 +            {
  1.1422 +                *this = detail::octonion_type_converter<float, long double>(a_recopier);
  1.1423 +            }
  1.1424 +            
  1.1425 +            // destructor
  1.1426 +            // (this is taken care of by the compiler itself)
  1.1427 +            
  1.1428 +            // accessors
  1.1429 +            //
  1.1430 +            // Note:    Like complex number, octonions do have a meaningful notion of "real part",
  1.1431 +            //            but unlike them there is no meaningful notion of "imaginary part".
  1.1432 +            //            Instead there is an "unreal part" which itself is an octonion, and usually
  1.1433 +            //            nothing simpler (as opposed to the complex number case).
  1.1434 +            //            However, for practicallity, there are accessors for the other components
  1.1435 +            //            (these are necessary for the templated copy constructor, for instance).
  1.1436 +            
  1.1437 +            BOOST_OCTONION_ACCESSOR_GENERATOR(float)
  1.1438 +            
  1.1439 +            // assignment operators
  1.1440 +            
  1.1441 +            BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR(float)
  1.1442 +            
  1.1443 +            // other assignment-related operators
  1.1444 +            //
  1.1445 +            // NOTE:    Octonion multiplication is *NOT* commutative;
  1.1446 +            //            symbolically, "q *= rhs;" means "q = q * rhs;"
  1.1447 +            //            and "q /= rhs;" means "q = q * inverse_of(rhs);";
  1.1448 +            //            octonion multiplication is also *NOT* associative
  1.1449 +            
  1.1450 +            BOOST_OCTONION_MEMBER_ALGEBRAIC_GENERATOR(float)
  1.1451 +            
  1.1452 +            
  1.1453 +        protected:
  1.1454 +            
  1.1455 +            BOOST_OCTONION_MEMBER_DATA_GENERATOR(float)
  1.1456 +            
  1.1457 +            
  1.1458 +        private:
  1.1459 +            
  1.1460 +        };
  1.1461 +        
  1.1462 +        
  1.1463 +        template<>
  1.1464 +        class octonion<double>
  1.1465 +        {
  1.1466 +        public:
  1.1467 +            
  1.1468 +            typedef double value_type;
  1.1469 +            
  1.1470 +            BOOST_OCTONION_CONSTRUCTOR_GENERATOR(double)
  1.1471 +            
  1.1472 +            // UNtemplated copy constructor
  1.1473 +            // (this is taken care of by the compiler itself)
  1.1474 +            
  1.1475 +            // converting copy constructor
  1.1476 +            
  1.1477 +            explicit                    octonion(octonion<float> const & a_recopier)
  1.1478 +            {
  1.1479 +                *this = detail::octonion_type_converter<double, float>(a_recopier);
  1.1480 +            }
  1.1481 +            
  1.1482 +            // explicit copy constructors (precision-loosing converters)
  1.1483 +            
  1.1484 +            explicit                    octonion(octonion<long double> const & a_recopier)
  1.1485 +            {
  1.1486 +                *this = detail::octonion_type_converter<double, long double>(a_recopier);
  1.1487 +            }
  1.1488 +            
  1.1489 +            // destructor
  1.1490 +            // (this is taken care of by the compiler itself)
  1.1491 +            
  1.1492 +            // accessors
  1.1493 +            //
  1.1494 +            // Note:    Like complex number, octonions do have a meaningful notion of "real part",
  1.1495 +            //            but unlike them there is no meaningful notion of "imaginary part".
  1.1496 +            //            Instead there is an "unreal part" which itself is an octonion, and usually
  1.1497 +            //            nothing simpler (as opposed to the complex number case).
  1.1498 +            //            However, for practicallity, there are accessors for the other components
  1.1499 +            //            (these are necessary for the templated copy constructor, for instance).
  1.1500 +            
  1.1501 +            BOOST_OCTONION_ACCESSOR_GENERATOR(double)
  1.1502 +            
  1.1503 +            // assignment operators
  1.1504 +            
  1.1505 +            BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR(double)
  1.1506 +            
  1.1507 +            // other assignment-related operators
  1.1508 +            //
  1.1509 +            // NOTE:    Octonion multiplication is *NOT* commutative;
  1.1510 +            //            symbolically, "q *= rhs;" means "q = q * rhs;"
  1.1511 +            //            and "q /= rhs;" means "q = q * inverse_of(rhs);";
  1.1512 +            //            octonion multiplication is also *NOT* associative
  1.1513 +            
  1.1514 +            BOOST_OCTONION_MEMBER_ALGEBRAIC_GENERATOR(double)
  1.1515 +            
  1.1516 +            
  1.1517 +        protected:
  1.1518 +            
  1.1519 +            BOOST_OCTONION_MEMBER_DATA_GENERATOR(double)
  1.1520 +            
  1.1521 +            
  1.1522 +        private:
  1.1523 +            
  1.1524 +        };
  1.1525 +        
  1.1526 +        
  1.1527 +        template<>
  1.1528 +        class octonion<long double>
  1.1529 +        {
  1.1530 +        public:
  1.1531 +            
  1.1532 +            typedef long double value_type;
  1.1533 +            
  1.1534 +            BOOST_OCTONION_CONSTRUCTOR_GENERATOR(long double)
  1.1535 +            
  1.1536 +            // UNtemplated copy constructor
  1.1537 +            // (this is taken care of by the compiler itself)
  1.1538 +            
  1.1539 +            // converting copy constructor
  1.1540 +            
  1.1541 +            explicit                            octonion(octonion<float> const & a_recopier)
  1.1542 +            {
  1.1543 +                *this = detail::octonion_type_converter<long double, float>(a_recopier);
  1.1544 +            }
  1.1545 +            
  1.1546 +            
  1.1547 +            explicit                            octonion(octonion<double> const & a_recopier)
  1.1548 +            {
  1.1549 +                *this = detail::octonion_type_converter<long double, double>(a_recopier);
  1.1550 +            }
  1.1551 +            
  1.1552 +            
  1.1553 +            // destructor
  1.1554 +            // (this is taken care of by the compiler itself)
  1.1555 +            
  1.1556 +            // accessors
  1.1557 +            //
  1.1558 +            // Note:    Like complex number, octonions do have a meaningful notion of "real part",
  1.1559 +            //            but unlike them there is no meaningful notion of "imaginary part".
  1.1560 +            //            Instead there is an "unreal part" which itself is an octonion, and usually
  1.1561 +            //            nothing simpler (as opposed to the complex number case).
  1.1562 +            //            However, for practicallity, there are accessors for the other components
  1.1563 +            //            (these are necessary for the templated copy constructor, for instance).
  1.1564 +            
  1.1565 +            BOOST_OCTONION_ACCESSOR_GENERATOR(long double)
  1.1566 +            
  1.1567 +            // assignment operators
  1.1568 +            
  1.1569 +            BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR(long double)
  1.1570 +            
  1.1571 +            // other assignment-related operators
  1.1572 +            //
  1.1573 +            // NOTE:    Octonion multiplication is *NOT* commutative;
  1.1574 +            //            symbolically, "q *= rhs;" means "q = q * rhs;"
  1.1575 +            //            and "q /= rhs;" means "q = q * inverse_of(rhs);";
  1.1576 +            //            octonion multiplication is also *NOT* associative
  1.1577 +            
  1.1578 +            BOOST_OCTONION_MEMBER_ALGEBRAIC_GENERATOR(long double)
  1.1579 +            
  1.1580 +            
  1.1581 +        protected:
  1.1582 +            
  1.1583 +            BOOST_OCTONION_MEMBER_DATA_GENERATOR(long double)
  1.1584 +            
  1.1585 +            
  1.1586 +        private:
  1.1587 +            
  1.1588 +        };
  1.1589 +        
  1.1590 +        
  1.1591 +#undef    BOOST_OCTONION_CONSTRUCTOR_GENERATOR
  1.1592 +        
  1.1593 +#undef    BOOST_OCTONION_MEMBER_ALGEBRAIC_GENERATOR
  1.1594 +    
  1.1595 +#undef    BOOST_OCTONION_MEMBER_ADD_GENERATOR
  1.1596 +#undef    BOOST_OCTONION_MEMBER_SUB_GENERATOR
  1.1597 +#undef    BOOST_OCTONION_MEMBER_MUL_GENERATOR
  1.1598 +#undef    BOOST_OCTONION_MEMBER_DIV_GENERATOR
  1.1599 +    
  1.1600 +#undef    BOOST_OCTONION_MEMBER_ADD_GENERATOR_1
  1.1601 +#undef    BOOST_OCTONION_MEMBER_ADD_GENERATOR_2
  1.1602 +#undef    BOOST_OCTONION_MEMBER_ADD_GENERATOR_3
  1.1603 +#undef    BOOST_OCTONION_MEMBER_ADD_GENERATOR_4
  1.1604 +#undef    BOOST_OCTONION_MEMBER_SUB_GENERATOR_1
  1.1605 +#undef    BOOST_OCTONION_MEMBER_SUB_GENERATOR_2
  1.1606 +#undef    BOOST_OCTONION_MEMBER_SUB_GENERATOR_3
  1.1607 +#undef    BOOST_OCTONION_MEMBER_SUB_GENERATOR_4
  1.1608 +#undef    BOOST_OCTONION_MEMBER_MUL_GENERATOR_1
  1.1609 +#undef    BOOST_OCTONION_MEMBER_MUL_GENERATOR_2
  1.1610 +#undef    BOOST_OCTONION_MEMBER_MUL_GENERATOR_3
  1.1611 +#undef    BOOST_OCTONION_MEMBER_MUL_GENERATOR_4
  1.1612 +#undef    BOOST_OCTONION_MEMBER_DIV_GENERATOR_1
  1.1613 +#undef    BOOST_OCTONION_MEMBER_DIV_GENERATOR_2
  1.1614 +#undef    BOOST_OCTONION_MEMBER_DIV_GENERATOR_3
  1.1615 +#undef    BOOST_OCTONION_MEMBER_DIV_GENERATOR_4
  1.1616 +    
  1.1617 +    
  1.1618 +#undef    BOOST_OCTONION_MEMBER_DATA_GENERATOR
  1.1619 +    
  1.1620 +#undef    BOOST_OCTONION_MEMBER_ASSIGNMENT_GENERATOR
  1.1621 +    
  1.1622 +#undef    BOOST_OCTONION_ACCESSOR_GENERATOR
  1.1623 +        
  1.1624 +        
  1.1625 +        // operators
  1.1626 +        
  1.1627 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) \
  1.1628 +        {                                             \
  1.1629 +            octonion<T>    res(lhs);                  \
  1.1630 +            res op##= rhs;                            \
  1.1631 +            return(res);                              \
  1.1632 +        }
  1.1633 +        
  1.1634 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_1_L(op)                                                                              \
  1.1635 +        template<typename T>                                                                                                      \
  1.1636 +        inline octonion<T>                        operator op (T const & lhs, octonion<T> const & rhs)                            \
  1.1637 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1638 +        
  1.1639 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_1_R(op)                                                                              \
  1.1640 +        template<typename T>                                                                                                      \
  1.1641 +        inline octonion<T>                        operator op (octonion<T> const & lhs, T const & rhs)                            \
  1.1642 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1643 +        
  1.1644 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_2_L(op)                                                                              \
  1.1645 +        template<typename T>                                                                                                      \
  1.1646 +        inline octonion<T>                        operator op (::std::complex<T> const & lhs, octonion<T> const & rhs)            \
  1.1647 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1648 +        
  1.1649 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_2_R(op)                                                                              \
  1.1650 +        template<typename T>                                                                                                      \
  1.1651 +        inline octonion<T>                        operator op (octonion<T> const & lhs, ::std::complex<T> const & rhs)            \
  1.1652 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1653 +        
  1.1654 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_3_L(op)                                                                              \
  1.1655 +        template<typename T>                                                                                                      \
  1.1656 +        inline octonion<T>                        operator op (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs) \
  1.1657 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1658 +        
  1.1659 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_3_R(op)                                                                              \
  1.1660 +        template<typename T>                                                                                                      \
  1.1661 +        inline octonion<T>                        operator op (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs) \
  1.1662 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1663 +        
  1.1664 +#define    BOOST_OCTONION_OPERATOR_GENERATOR_4(op)                                                                                \
  1.1665 +        template<typename T>                                                                                                      \
  1.1666 +        inline octonion<T>                        operator op (octonion<T> const & lhs, octonion<T> const & rhs)                  \
  1.1667 +        BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op)
  1.1668 +        
  1.1669 +#define    BOOST_OCTONION_OPERATOR_GENERATOR(op)     \
  1.1670 +        BOOST_OCTONION_OPERATOR_GENERATOR_1_L(op)    \
  1.1671 +        BOOST_OCTONION_OPERATOR_GENERATOR_1_R(op)    \
  1.1672 +        BOOST_OCTONION_OPERATOR_GENERATOR_2_L(op)    \
  1.1673 +        BOOST_OCTONION_OPERATOR_GENERATOR_2_R(op)    \
  1.1674 +        BOOST_OCTONION_OPERATOR_GENERATOR_3_L(op)    \
  1.1675 +        BOOST_OCTONION_OPERATOR_GENERATOR_3_R(op)    \
  1.1676 +        BOOST_OCTONION_OPERATOR_GENERATOR_4(op)
  1.1677 +        
  1.1678 +        
  1.1679 +        BOOST_OCTONION_OPERATOR_GENERATOR(+)
  1.1680 +        BOOST_OCTONION_OPERATOR_GENERATOR(-)
  1.1681 +        BOOST_OCTONION_OPERATOR_GENERATOR(*)
  1.1682 +        BOOST_OCTONION_OPERATOR_GENERATOR(/)
  1.1683 +        
  1.1684 +        
  1.1685 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR
  1.1686 +        
  1.1687 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_1_L
  1.1688 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_1_R
  1.1689 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_2_L
  1.1690 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_2_R
  1.1691 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_3_L
  1.1692 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_3_R
  1.1693 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_4
  1.1694 +    
  1.1695 +#undef    BOOST_OCTONION_OPERATOR_GENERATOR_BODY
  1.1696 +        
  1.1697 +        
  1.1698 +        template<typename T>
  1.1699 +        inline octonion<T>                        operator + (octonion<T> const & o)
  1.1700 +        {
  1.1701 +            return(o);
  1.1702 +        }
  1.1703 +        
  1.1704 +        
  1.1705 +        template<typename T>
  1.1706 +        inline octonion<T>                        operator - (octonion<T> const & o)
  1.1707 +        {
  1.1708 +            return(octonion<T>(-o.R_component_1(),-o.R_component_2(),-o.R_component_3(),-o.R_component_4(),-o.R_component_5(),-o.R_component_6(),-o.R_component_7(),-o.R_component_8()));
  1.1709 +        }
  1.1710 +        
  1.1711 +        
  1.1712 +        template<typename T>
  1.1713 +        inline bool                                operator == (T const & lhs, octonion<T> const & rhs)
  1.1714 +        {
  1.1715 +            return(
  1.1716 +                        (rhs.R_component_1() == lhs)&&
  1.1717 +                        (rhs.R_component_2() == static_cast<T>(0))&&
  1.1718 +                        (rhs.R_component_3() == static_cast<T>(0))&&
  1.1719 +                        (rhs.R_component_4() == static_cast<T>(0))&&
  1.1720 +                        (rhs.R_component_5() == static_cast<T>(0))&&
  1.1721 +                        (rhs.R_component_6() == static_cast<T>(0))&&
  1.1722 +                        (rhs.R_component_7() == static_cast<T>(0))&&
  1.1723 +                        (rhs.R_component_8() == static_cast<T>(0))
  1.1724 +                    );
  1.1725 +        }
  1.1726 +        
  1.1727 +        
  1.1728 +        template<typename T>
  1.1729 +        inline bool                                operator == (octonion<T> const & lhs, T const & rhs)
  1.1730 +        {
  1.1731 +            return(
  1.1732 +                        (lhs.R_component_1() == rhs)&&
  1.1733 +                        (lhs.R_component_2() == static_cast<T>(0))&&
  1.1734 +                        (lhs.R_component_3() == static_cast<T>(0))&&
  1.1735 +                        (lhs.R_component_4() == static_cast<T>(0))&&
  1.1736 +                        (lhs.R_component_5() == static_cast<T>(0))&&
  1.1737 +                        (lhs.R_component_6() == static_cast<T>(0))&&
  1.1738 +                        (lhs.R_component_7() == static_cast<T>(0))&&
  1.1739 +                        (lhs.R_component_8() == static_cast<T>(0))
  1.1740 +                    );
  1.1741 +        }
  1.1742 +        
  1.1743 +        
  1.1744 +        template<typename T>
  1.1745 +        inline bool                                operator == (::std::complex<T> const & lhs, octonion<T> const & rhs)
  1.1746 +        {
  1.1747 +            return(
  1.1748 +                        (rhs.R_component_1() == lhs.real())&&
  1.1749 +                        (rhs.R_component_2() == lhs.imag())&&
  1.1750 +                        (rhs.R_component_3() == static_cast<T>(0))&&
  1.1751 +                        (rhs.R_component_4() == static_cast<T>(0))&&
  1.1752 +                        (rhs.R_component_5() == static_cast<T>(0))&&
  1.1753 +                        (rhs.R_component_6() == static_cast<T>(0))&&
  1.1754 +                        (rhs.R_component_7() == static_cast<T>(0))&&
  1.1755 +                        (rhs.R_component_8() == static_cast<T>(0))
  1.1756 +                    );
  1.1757 +        }
  1.1758 +        
  1.1759 +        
  1.1760 +        template<typename T>
  1.1761 +        inline bool                                operator == (octonion<T> const & lhs, ::std::complex<T> const & rhs)
  1.1762 +        {
  1.1763 +            return(
  1.1764 +                        (lhs.R_component_1() == rhs.real())&&
  1.1765 +                        (lhs.R_component_2() == rhs.imag())&&
  1.1766 +                        (lhs.R_component_3() == static_cast<T>(0))&&
  1.1767 +                        (lhs.R_component_4() == static_cast<T>(0))&&
  1.1768 +                        (lhs.R_component_5() == static_cast<T>(0))&&
  1.1769 +                        (lhs.R_component_6() == static_cast<T>(0))&&
  1.1770 +                        (lhs.R_component_7() == static_cast<T>(0))&&
  1.1771 +                        (lhs.R_component_8() == static_cast<T>(0))
  1.1772 +                    );
  1.1773 +        }
  1.1774 +        
  1.1775 +        
  1.1776 +        template<typename T>
  1.1777 +        inline bool                                operator == (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs)
  1.1778 +        {
  1.1779 +            return(
  1.1780 +                        (rhs.R_component_1() == lhs.R_component_1())&&
  1.1781 +                        (rhs.R_component_2() == lhs.R_component_2())&&
  1.1782 +                        (rhs.R_component_3() == lhs.R_component_3())&&
  1.1783 +                        (rhs.R_component_4() == lhs.R_component_4())&&
  1.1784 +                        (rhs.R_component_5() == static_cast<T>(0))&&
  1.1785 +                        (rhs.R_component_6() == static_cast<T>(0))&&
  1.1786 +                        (rhs.R_component_7() == static_cast<T>(0))&&
  1.1787 +                        (rhs.R_component_8() == static_cast<T>(0))
  1.1788 +                    );
  1.1789 +        }
  1.1790 +        
  1.1791 +        
  1.1792 +        template<typename T>
  1.1793 +        inline bool                                operator == (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs)
  1.1794 +        {
  1.1795 +            return(
  1.1796 +                        (lhs.R_component_1() == rhs.R_component_1())&&
  1.1797 +                        (lhs.R_component_2() == rhs.R_component_2())&&
  1.1798 +                        (lhs.R_component_3() == rhs.R_component_3())&&
  1.1799 +                        (lhs.R_component_4() == rhs.R_component_4())&&
  1.1800 +                        (lhs.R_component_5() == static_cast<T>(0))&&
  1.1801 +                        (lhs.R_component_6() == static_cast<T>(0))&&
  1.1802 +                        (lhs.R_component_7() == static_cast<T>(0))&&
  1.1803 +                        (lhs.R_component_8() == static_cast<T>(0))
  1.1804 +                    );
  1.1805 +        }
  1.1806 +        
  1.1807 +        
  1.1808 +        template<typename T>
  1.1809 +        inline bool                                operator == (octonion<T> const & lhs, octonion<T> const & rhs)
  1.1810 +        {
  1.1811 +            return(
  1.1812 +                        (rhs.R_component_1() == lhs.R_component_1())&&
  1.1813 +                        (rhs.R_component_2() == lhs.R_component_2())&&
  1.1814 +                        (rhs.R_component_3() == lhs.R_component_3())&&
  1.1815 +                        (rhs.R_component_4() == lhs.R_component_4())&&
  1.1816 +                        (rhs.R_component_5() == lhs.R_component_5())&&
  1.1817 +                        (rhs.R_component_6() == lhs.R_component_6())&&
  1.1818 +                        (rhs.R_component_7() == lhs.R_component_7())&&
  1.1819 +                        (rhs.R_component_8() == lhs.R_component_8())
  1.1820 +                    );
  1.1821 +        }
  1.1822 +        
  1.1823 +        
  1.1824 +#define    BOOST_OCTONION_NOT_EQUAL_GENERATOR \
  1.1825 +        {                                     \
  1.1826 +            return(!(lhs == rhs));            \
  1.1827 +        }
  1.1828 +        
  1.1829 +        template<typename T>
  1.1830 +        inline bool                                operator != (T const & lhs, octonion<T> const & rhs)
  1.1831 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1832 +        
  1.1833 +        template<typename T>
  1.1834 +        inline bool                                operator != (octonion<T> const & lhs, T const & rhs)
  1.1835 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1836 +        
  1.1837 +        template<typename T>
  1.1838 +        inline bool                                operator != (::std::complex<T> const & lhs, octonion<T> const & rhs)
  1.1839 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1840 +        
  1.1841 +        template<typename T>
  1.1842 +        inline bool                                operator != (octonion<T> const & lhs, ::std::complex<T> const & rhs)
  1.1843 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1844 +        
  1.1845 +        template<typename T>
  1.1846 +        inline bool                                operator != (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs)
  1.1847 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1848 +        
  1.1849 +        template<typename T>
  1.1850 +        inline bool                                operator != (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs)
  1.1851 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1852 +        
  1.1853 +        template<typename T>
  1.1854 +        inline bool                                operator != (octonion<T> const & lhs, octonion<T> const & rhs)
  1.1855 +        BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1856 +        
  1.1857 +    #undef    BOOST_OCTONION_NOT_EQUAL_GENERATOR
  1.1858 +        
  1.1859 +        
  1.1860 +        // Note:    the default values in the constructors of the complex and quaternions make for
  1.1861 +        //            a very complex and ambiguous situation; we have made choices to disambiguate.
  1.1862 +        
  1.1863 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.1864 +        template<typename T>
  1.1865 +        ::std::istream &                        operator >> (    ::std::istream & is,
  1.1866 +                                                                octonion<T>& o)
  1.1867 +#else
  1.1868 +        template<typename T, typename charT, class traits>
  1.1869 +        ::std::basic_istream<charT,traits> &    operator >> (    ::std::basic_istream<charT,traits> & is,
  1.1870 +                                                                octonion<T> & o)
  1.1871 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.1872 +        {
  1.1873 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.1874 +            typedef    char    charT;
  1.1875 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.1876 +            
  1.1877 +#ifdef     BOOST_NO_STD_LOCALE
  1.1878 +#else
  1.1879 +            const ::std::ctype<charT> & ct = ::std::use_facet< ::std::ctype<charT> >(is.getloc());
  1.1880 +#endif /* BOOST_NO_STD_LOCALE */
  1.1881 +            
  1.1882 +            T    a = T();
  1.1883 +            T    b = T();
  1.1884 +            T    c = T();
  1.1885 +            T    d = T();
  1.1886 +            T    e = T();
  1.1887 +            T    f = T();
  1.1888 +            T    g = T();
  1.1889 +            T    h = T();
  1.1890 +            
  1.1891 +            ::std::complex<T>    u = ::std::complex<T>();
  1.1892 +            ::std::complex<T>    v = ::std::complex<T>();
  1.1893 +            ::std::complex<T>    x = ::std::complex<T>();
  1.1894 +            ::std::complex<T>    y = ::std::complex<T>();
  1.1895 +            
  1.1896 +            ::boost::math::quaternion<T>    p = ::boost::math::quaternion<T>();
  1.1897 +            ::boost::math::quaternion<T>    q = ::boost::math::quaternion<T>();
  1.1898 +            
  1.1899 +            charT    ch = charT();
  1.1900 +            char    cc;
  1.1901 +            
  1.1902 +            is >> ch;                                        // get the first lexeme
  1.1903 +            
  1.1904 +            if    (!is.good())    goto finish;
  1.1905 +            
  1.1906 +#ifdef    BOOST_NO_STD_LOCALE
  1.1907 +            cc = ch;
  1.1908 +#else
  1.1909 +            cc = ct.narrow(ch, char());
  1.1910 +#endif /* BOOST_NO_STD_LOCALE */
  1.1911 +            
  1.1912 +            if    (cc == '(')                            // read "("
  1.1913 +            {
  1.1914 +                is >> ch;                                    // get the second lexeme
  1.1915 +                
  1.1916 +                if    (!is.good())    goto finish;
  1.1917 +                
  1.1918 +#ifdef    BOOST_NO_STD_LOCALE
  1.1919 +                cc = ch;
  1.1920 +#else
  1.1921 +                cc = ct.narrow(ch, char());
  1.1922 +#endif /* BOOST_NO_STD_LOCALE */
  1.1923 +                
  1.1924 +                if    (cc == '(')                                // read "(("
  1.1925 +                {
  1.1926 +                    is >> ch;                                    // get the third lexeme
  1.1927 +                    
  1.1928 +                    if    (!is.good())    goto finish;
  1.1929 +                    
  1.1930 +#ifdef    BOOST_NO_STD_LOCALE
  1.1931 +                    cc = ch;
  1.1932 +#else
  1.1933 +                    cc = ct.narrow(ch, char());
  1.1934 +#endif /* BOOST_NO_STD_LOCALE */
  1.1935 +                        
  1.1936 +                    if    (cc == '(')                                // read "((("
  1.1937 +                    {
  1.1938 +                        is.putback(ch);
  1.1939 +                        
  1.1940 +                        is >> u;                                // read "((u"
  1.1941 +                        
  1.1942 +                        if    (!is.good())    goto finish;
  1.1943 +                        
  1.1944 +                        is >> ch;                                // get the next lexeme
  1.1945 +                        
  1.1946 +                        if    (!is.good())    goto finish;
  1.1947 +                        
  1.1948 +#ifdef    BOOST_NO_STD_LOCALE
  1.1949 +                        cc = ch;
  1.1950 +#else
  1.1951 +                        cc = ct.narrow(ch, char());
  1.1952 +#endif /* BOOST_NO_STD_LOCALE */
  1.1953 +                        
  1.1954 +                        if        (cc == ')')                        // read "((u)"
  1.1955 +                        {
  1.1956 +                            is >> ch;                                // get the next lexeme
  1.1957 +                            
  1.1958 +                            if    (!is.good())    goto finish;
  1.1959 +                            
  1.1960 +#ifdef    BOOST_NO_STD_LOCALE
  1.1961 +                            cc = ch;
  1.1962 +#else
  1.1963 +                            cc = ct.narrow(ch, char());
  1.1964 +#endif /* BOOST_NO_STD_LOCALE */
  1.1965 +                            
  1.1966 +                            if        (cc == ')')                        // format: (((a))), (((a,b)))
  1.1967 +                            {
  1.1968 +                                o = octonion<T>(u);
  1.1969 +                            }
  1.1970 +                            else if    (cc == ',')                        // read "((u),"
  1.1971 +                            {
  1.1972 +                                p = ::boost::math::quaternion<T>(u);
  1.1973 +                                
  1.1974 +                                is >> q;                                // read "((u),q"
  1.1975 +                                
  1.1976 +                                if    (!is.good())    goto finish;
  1.1977 +                                
  1.1978 +                                is >> ch;                                // get the next lexeme
  1.1979 +                                
  1.1980 +                                if    (!is.good())    goto finish;
  1.1981 +                                
  1.1982 +#ifdef    BOOST_NO_STD_LOCALE
  1.1983 +                                cc = ch;
  1.1984 +#else
  1.1985 +                                cc = ct.narrow(ch, char());
  1.1986 +#endif /* BOOST_NO_STD_LOCALE */
  1.1987 +                                
  1.1988 +                                if        (cc == ')')                        // format: (((a)),q), (((a,b)),q)
  1.1989 +                                {
  1.1990 +                                    o = octonion<T>(p,q);
  1.1991 +                                }
  1.1992 +                                else                                    // error
  1.1993 +                                {
  1.1994 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.1995 +                                    is.setstate(::std::ios::failbit);
  1.1996 +#else
  1.1997 +                                    is.setstate(::std::ios_base::failbit);
  1.1998 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.1999 +                                }
  1.2000 +                            }
  1.2001 +                            else                                    // error
  1.2002 +                            {
  1.2003 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2004 +                                is.setstate(::std::ios::failbit);
  1.2005 +#else
  1.2006 +                                is.setstate(::std::ios_base::failbit);
  1.2007 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2008 +                            }
  1.2009 +                        }
  1.2010 +                        else if    (cc ==',')                        // read "((u,"
  1.2011 +                        {
  1.2012 +                            is >> v;                                // read "((u,v"
  1.2013 +                            
  1.2014 +                            if    (!is.good())    goto finish;
  1.2015 +                            
  1.2016 +                            is >> ch;                                // get the next lexeme
  1.2017 +                            
  1.2018 +                            if    (!is.good())    goto finish;
  1.2019 +
  1.2020 +#ifdef    BOOST_NO_STD_LOCALE
  1.2021 +                            cc = ch;
  1.2022 +#else
  1.2023 +                            cc = ct.narrow(ch, char());
  1.2024 +#endif /* BOOST_NO_STD_LOCALE */
  1.2025 +                            
  1.2026 +                            if        (cc == ')')                        // read "((u,v)"
  1.2027 +                            {
  1.2028 +                                p = ::boost::math::quaternion<T>(u,v);
  1.2029 +                                
  1.2030 +                                is >> ch;                                // get the next lexeme
  1.2031 +                                
  1.2032 +                                if    (!is.good())    goto finish;
  1.2033 +
  1.2034 +#ifdef    BOOST_NO_STD_LOCALE
  1.2035 +                                cc = ch;
  1.2036 +#else
  1.2037 +                                cc = ct.narrow(ch, char());
  1.2038 +#endif /* BOOST_NO_STD_LOCALE */
  1.2039 +                                
  1.2040 +                                if        (cc == ')')                        // format: (((a),v)), (((a,b),v))
  1.2041 +                                {
  1.2042 +                                    o = octonion<T>(p);
  1.2043 +                                }
  1.2044 +                                else if    (cc == ',')                        // read "((u,v),"
  1.2045 +                                {
  1.2046 +                                    is >> q;                                // read "(p,q"
  1.2047 +                                    
  1.2048 +                                    if    (!is.good())    goto finish;
  1.2049 +                                    
  1.2050 +                                    is >> ch;                                // get the next lexeme
  1.2051 +                                    
  1.2052 +                                    if    (!is.good())    goto finish;
  1.2053 +
  1.2054 +#ifdef    BOOST_NO_STD_LOCALE
  1.2055 +                                    cc = ch;
  1.2056 +#else
  1.2057 +                                    cc = ct.narrow(ch, char());
  1.2058 +#endif /* BOOST_NO_STD_LOCALE */
  1.2059 +                                    
  1.2060 +                                    if        (cc == ')')                        // format: (((a),v),q), (((a,b),v),q)
  1.2061 +                                    {
  1.2062 +                                        o = octonion<T>(p,q);
  1.2063 +                                    }
  1.2064 +                                    else                                    // error
  1.2065 +                                    {
  1.2066 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2067 +                                        is.setstate(::std::ios::failbit);
  1.2068 +#else
  1.2069 +                                        is.setstate(::std::ios_base::failbit);
  1.2070 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2071 +                                    }
  1.2072 +                                }
  1.2073 +                                else                                    // error
  1.2074 +                                {
  1.2075 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2076 +                                    is.setstate(::std::ios::failbit);
  1.2077 +#else
  1.2078 +                                    is.setstate(::std::ios_base::failbit);
  1.2079 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2080 +                                }
  1.2081 +                            }
  1.2082 +                            else                                    // error
  1.2083 +                            {
  1.2084 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2085 +                                is.setstate(::std::ios::failbit);
  1.2086 +#else
  1.2087 +                                is.setstate(::std::ios_base::failbit);
  1.2088 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2089 +                            }
  1.2090 +                        }
  1.2091 +                        else                                    // error
  1.2092 +                        {
  1.2093 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2094 +                            is.setstate(::std::ios::failbit);
  1.2095 +#else
  1.2096 +                            is.setstate(::std::ios_base::failbit);
  1.2097 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2098 +                        }
  1.2099 +                    }
  1.2100 +                    else                                        // read "((a"
  1.2101 +                    {
  1.2102 +                        is.putback(ch);
  1.2103 +                        
  1.2104 +                        is >> a;                                    // we extract the first component
  1.2105 +                        
  1.2106 +                        if    (!is.good())    goto finish;
  1.2107 +                        
  1.2108 +                        is >> ch;                                    // get the next lexeme
  1.2109 +                        
  1.2110 +                        if    (!is.good())    goto finish;
  1.2111 +
  1.2112 +#ifdef    BOOST_NO_STD_LOCALE
  1.2113 +                        cc = ch;
  1.2114 +#else
  1.2115 +                        cc = ct.narrow(ch, char());
  1.2116 +#endif /* BOOST_NO_STD_LOCALE */
  1.2117 +                        
  1.2118 +                        if        (cc == ')')                            // read "((a)"
  1.2119 +                        {
  1.2120 +                            is >> ch;                                    // get the next lexeme
  1.2121 +                            
  1.2122 +                            if    (!is.good())    goto finish;
  1.2123 +
  1.2124 +#ifdef    BOOST_NO_STD_LOCALE
  1.2125 +                            cc = ch;
  1.2126 +#else
  1.2127 +                            cc = ct.narrow(ch, char());
  1.2128 +#endif /* BOOST_NO_STD_LOCALE */
  1.2129 +                            
  1.2130 +                            if        (cc == ')')                            // read "((a))"
  1.2131 +                            {
  1.2132 +                                o = octonion<T>(a);
  1.2133 +                            }
  1.2134 +                            else if    (cc == ',')                            // read "((a),"
  1.2135 +                            {
  1.2136 +                                is >> ch;                                    // get the next lexeme
  1.2137 +                                
  1.2138 +                                if    (!is.good())    goto finish;
  1.2139 +                                
  1.2140 +#ifdef    BOOST_NO_STD_LOCALE
  1.2141 +                                cc = ch;
  1.2142 +#else
  1.2143 +                                cc = ct.narrow(ch, char());
  1.2144 +#endif /* BOOST_NO_STD_LOCALE */
  1.2145 +                                
  1.2146 +                                if        (cc == '(')                            // read "((a),("
  1.2147 +                                {
  1.2148 +                                    is >> ch;                                    // get the next lexeme
  1.2149 +                                    
  1.2150 +                                    if    (!is.good())    goto finish;
  1.2151 +
  1.2152 +#ifdef    BOOST_NO_STD_LOCALE
  1.2153 +                                    cc = ch;
  1.2154 +#else
  1.2155 +                                    cc = ct.narrow(ch, char());
  1.2156 +#endif /* BOOST_NO_STD_LOCALE */
  1.2157 +                                    
  1.2158 +                                    if        (cc == '(')                            // read "((a),(("
  1.2159 +                                    {
  1.2160 +                                        is.putback(ch);
  1.2161 +                                        
  1.2162 +                                        is.putback(ch);                                // we backtrack twice, with the same value!
  1.2163 +                                        
  1.2164 +                                        is >> q;                                    // read "((a),q"
  1.2165 +                                        
  1.2166 +                                        if    (!is.good())    goto finish;
  1.2167 +                                        
  1.2168 +                                        is >> ch;                                    // get the next lexeme
  1.2169 +                                        
  1.2170 +                                        if    (!is.good())    goto finish;
  1.2171 +
  1.2172 +#ifdef    BOOST_NO_STD_LOCALE
  1.2173 +                                        cc = ch;
  1.2174 +#else
  1.2175 +                                        cc = ct.narrow(ch, char());
  1.2176 +#endif /* BOOST_NO_STD_LOCALE */
  1.2177 +                                        
  1.2178 +                                        if        (cc == ')')                            // read "((a),q)"
  1.2179 +                                        {
  1.2180 +                                            p = ::boost::math::quaternion<T>(a);
  1.2181 +                                            
  1.2182 +                                            o = octonion<T>(p,q);
  1.2183 +                                        }
  1.2184 +                                        else                                        // error
  1.2185 +                                        {
  1.2186 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2187 +                                            is.setstate(::std::ios::failbit);
  1.2188 +#else
  1.2189 +                                            is.setstate(::std::ios_base::failbit);
  1.2190 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2191 +                                        }
  1.2192 +                                    }
  1.2193 +                                    else                                        // read "((a),(c" or "((a),(e"
  1.2194 +                                    {
  1.2195 +                                        is.putback(ch);
  1.2196 +                                        
  1.2197 +                                        is >> c;
  1.2198 +                                        
  1.2199 +                                        if    (!is.good())    goto finish;
  1.2200 +                                        
  1.2201 +                                        is >> ch;                                    // get the next lexeme
  1.2202 +                                        
  1.2203 +                                        if    (!is.good())    goto finish;
  1.2204 +                                        
  1.2205 +#ifdef    BOOST_NO_STD_LOCALE
  1.2206 +                                        cc = ch;
  1.2207 +#else
  1.2208 +                                        cc = ct.narrow(ch, char());
  1.2209 +#endif /* BOOST_NO_STD_LOCALE */
  1.2210 +                                        
  1.2211 +                                        if        (cc == ')')                            // read "((a),(c)" (ambiguity resolution)
  1.2212 +                                        {
  1.2213 +                                            is >> ch;                                    // get the next lexeme
  1.2214 +                                            
  1.2215 +                                            if    (!is.good())    goto finish;
  1.2216 +                                            
  1.2217 +#ifdef    BOOST_NO_STD_LOCALE
  1.2218 +                                            cc = ch;
  1.2219 +#else
  1.2220 +                                            cc = ct.narrow(ch, char());
  1.2221 +#endif /* BOOST_NO_STD_LOCALE */
  1.2222 +                                            
  1.2223 +                                            if        (cc == ')')                        // read "((a),(c))"
  1.2224 +                                            {
  1.2225 +                                                o = octonion<T>(a,b,c);
  1.2226 +                                            }
  1.2227 +                                            else if    (cc == ',')                        // read "((a),(c),"
  1.2228 +                                            {
  1.2229 +                                                u = ::std::complex<T>(a);
  1.2230 +                                                
  1.2231 +                                                v = ::std::complex<T>(c);
  1.2232 +                                                
  1.2233 +                                                is >> x;                            // read "((a),(c),x"
  1.2234 +                                                
  1.2235 +                                                if    (!is.good())    goto finish;
  1.2236 +                                                
  1.2237 +                                                is >> ch;                                // get the next lexeme
  1.2238 +                                                
  1.2239 +                                                if    (!is.good())    goto finish;
  1.2240 +                                                
  1.2241 +#ifdef    BOOST_NO_STD_LOCALE
  1.2242 +                                                cc = ch;
  1.2243 +#else
  1.2244 +                                                cc = ct.narrow(ch, char());
  1.2245 +#endif /* BOOST_NO_STD_LOCALE */
  1.2246 +                                                
  1.2247 +                                                if        (cc == ')')                        // read "((a),(c),x)"
  1.2248 +                                                {
  1.2249 +                                                    o = octonion<T>(u,v,x);
  1.2250 +                                                }
  1.2251 +                                                else if    (cc == ',')                        // read "((a),(c),x,"
  1.2252 +                                                {
  1.2253 +                                                    is >> y;                                // read "((a),(c),x,y"
  1.2254 +                                                    
  1.2255 +                                                    if    (!is.good())    goto finish;
  1.2256 +                                                    
  1.2257 +                                                    is >> ch;                                // get the next lexeme
  1.2258 +                                                    
  1.2259 +                                                    if    (!is.good())    goto finish;
  1.2260 +                                                    
  1.2261 +#ifdef    BOOST_NO_STD_LOCALE
  1.2262 +                                                    cc = ch;
  1.2263 +#else
  1.2264 +                                                    cc = ct.narrow(ch, char());
  1.2265 +#endif /* BOOST_NO_STD_LOCALE */
  1.2266 +                                                    
  1.2267 +                                                    if        (cc == ')')                        // read "((a),(c),x,y)"
  1.2268 +                                                    {
  1.2269 +                                                        o = octonion<T>(u,v,x,y);
  1.2270 +                                                    }
  1.2271 +                                                    else                                    // error
  1.2272 +                                                    {
  1.2273 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2274 +                                                        is.setstate(::std::ios::failbit);
  1.2275 +#else
  1.2276 +                                                        is.setstate(::std::ios_base::failbit);
  1.2277 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2278 +                                                    }
  1.2279 +                                                }
  1.2280 +                                                else                                    // error
  1.2281 +                                                {
  1.2282 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2283 +                                                    is.setstate(::std::ios::failbit);
  1.2284 +#else
  1.2285 +                                                    is.setstate(::std::ios_base::failbit);
  1.2286 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2287 +                                                }
  1.2288 +                                            }
  1.2289 +                                            else                                    // error
  1.2290 +                                            {
  1.2291 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2292 +                                                is.setstate(::std::ios::failbit);
  1.2293 +#else
  1.2294 +                                                is.setstate(::std::ios_base::failbit);
  1.2295 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2296 +                                            }
  1.2297 +                                        }
  1.2298 +                                        else if    (cc == ',')                            // read "((a),(c," or "((a),(e,"
  1.2299 +                                        {
  1.2300 +                                            is >> ch;                                // get the next lexeme
  1.2301 +                                            
  1.2302 +                                            if    (!is.good())    goto finish;
  1.2303 +
  1.2304 +#ifdef    BOOST_NO_STD_LOCALE
  1.2305 +                                            cc = ch;
  1.2306 +#else
  1.2307 +                                            cc = ct.narrow(ch, char());
  1.2308 +#endif /* BOOST_NO_STD_LOCALE */
  1.2309 +                                            
  1.2310 +                                            if        (cc == '(')                        // read "((a),(e,(" (ambiguity resolution)
  1.2311 +                                            {
  1.2312 +                                                p = ::boost::math::quaternion<T>(a);
  1.2313 +                                                
  1.2314 +                                                x = ::std::complex<T>(c);                // "c" was actually "e"
  1.2315 +                                                
  1.2316 +                                                is.putback(ch);                            // we can only backtrace once
  1.2317 +                                                
  1.2318 +                                                is >> y;                                // read "((a),(e,y"
  1.2319 +                                                
  1.2320 +                                                if    (!is.good())    goto finish;
  1.2321 +                                                
  1.2322 +                                                is >> ch;                                // get the next lexeme
  1.2323 +                                                
  1.2324 +#ifdef    BOOST_NO_STD_LOCALE
  1.2325 +                                                cc = ch;
  1.2326 +#else
  1.2327 +                                                cc = ct.narrow(ch, char());
  1.2328 +#endif /* BOOST_NO_STD_LOCALE */
  1.2329 +                                                
  1.2330 +                                                if        (cc == ')')                        // read "((a),(e,y)"
  1.2331 +                                                {
  1.2332 +                                                    q = ::boost::math::quaternion<T>(x,y);
  1.2333 +                                                    
  1.2334 +                                                    is >> ch;                                // get the next lexeme
  1.2335 +
  1.2336 +#ifdef    BOOST_NO_STD_LOCALE
  1.2337 +                                                    cc = ch;
  1.2338 +#else
  1.2339 +                                                    cc = ct.narrow(ch, char());
  1.2340 +#endif /* BOOST_NO_STD_LOCALE */
  1.2341 +                                                    
  1.2342 +                                                    if        (cc == ')')                        // read "((a),(e,y))"
  1.2343 +                                                    {
  1.2344 +                                                        o = octonion<T>(p,q);
  1.2345 +                                                    }
  1.2346 +                                                    else                                    // error
  1.2347 +                                                    {
  1.2348 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2349 +                                                        is.setstate(::std::ios::failbit);
  1.2350 +#else
  1.2351 +                                                        is.setstate(::std::ios_base::failbit);
  1.2352 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2353 +                                                    }
  1.2354 +                                                }
  1.2355 +                                                else                                    // error
  1.2356 +                                                {
  1.2357 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2358 +                                                    is.setstate(::std::ios::failbit);
  1.2359 +#else
  1.2360 +                                                    is.setstate(::std::ios_base::failbit);
  1.2361 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2362 +                                                }
  1.2363 +                                            }
  1.2364 +                                            else                                    // read "((a),(c,d" or "((a),(e,f"
  1.2365 +                                            {
  1.2366 +                                                is.putback(ch);
  1.2367 +                                                
  1.2368 +                                                is >> d;
  1.2369 +                                                
  1.2370 +                                                if    (!is.good())    goto finish;
  1.2371 +                                                
  1.2372 +                                                is >> ch;                                // get the next lexeme
  1.2373 +                                                
  1.2374 +                                                if    (!is.good())    goto finish;
  1.2375 +                                                
  1.2376 +#ifdef    BOOST_NO_STD_LOCALE
  1.2377 +                                                cc = ch;
  1.2378 +#else
  1.2379 +                                                cc = ct.narrow(ch, char());
  1.2380 +#endif /* BOOST_NO_STD_LOCALE */
  1.2381 +                                                
  1.2382 +                                                if        (cc == ')')                        // read "((a),(c,d)" (ambiguity resolution)
  1.2383 +                                                {
  1.2384 +                                                    is >> ch;                                // get the next lexeme
  1.2385 +                                                    
  1.2386 +                                                    if    (!is.good())    goto finish;
  1.2387 +
  1.2388 +#ifdef    BOOST_NO_STD_LOCALE
  1.2389 +                                                    cc = ch;
  1.2390 +#else
  1.2391 +                                                    cc = ct.narrow(ch, char());
  1.2392 +#endif /* BOOST_NO_STD_LOCALE */
  1.2393 +                                                    
  1.2394 +                                                    if        (cc == ')')                        // read "((a),(c,d))"
  1.2395 +                                                    {
  1.2396 +                                                        o = octonion<T>(a,b,c,d);
  1.2397 +                                                    }
  1.2398 +                                                    else if    (cc == ',')                        // read "((a),(c,d),"
  1.2399 +                                                    {
  1.2400 +                                                        u = ::std::complex<T>(a);
  1.2401 +                                                        
  1.2402 +                                                        v = ::std::complex<T>(c,d);
  1.2403 +                                                        
  1.2404 +                                                        is >> x;                                // read "((a),(c,d),x"
  1.2405 +                                                        
  1.2406 +                                                        if    (!is.good())    goto finish;
  1.2407 +                                                        
  1.2408 +                                                        is >> ch;                                // get the next lexeme
  1.2409 +                                                        
  1.2410 +                                                        if    (!is.good())    goto finish;
  1.2411 +                                                        
  1.2412 +#ifdef    BOOST_NO_STD_LOCALE
  1.2413 +                                                        cc = ch;
  1.2414 +#else
  1.2415 +                                                        cc = ct.narrow(ch, char());
  1.2416 +#endif /* BOOST_NO_STD_LOCALE */
  1.2417 +                                                        
  1.2418 +                                                        if        (cc == ')')                        // read "((a),(c,d),x)"
  1.2419 +                                                        {
  1.2420 +                                                            o = octonion<T>(u,v,x);
  1.2421 +                                                        }
  1.2422 +                                                        else if    (cc == ',')                        // read "((a),(c,d),x,"
  1.2423 +                                                        {
  1.2424 +                                                            is >> y;                                // read "((a),(c,d),x,y"
  1.2425 +                                                            
  1.2426 +                                                            if    (!is.good())    goto finish;
  1.2427 +                                                            
  1.2428 +                                                            is >> ch;                                // get the next lexeme
  1.2429 +                                                            
  1.2430 +                                                            if    (!is.good())    goto finish;
  1.2431 +                                                            
  1.2432 +#ifdef    BOOST_NO_STD_LOCALE
  1.2433 +                                                            cc = ch;
  1.2434 +#else
  1.2435 +                                                            cc = ct.narrow(ch, char());
  1.2436 +#endif /* BOOST_NO_STD_LOCALE */
  1.2437 +                                                            
  1.2438 +                                                            if        (cc == ')')                        // read "((a),(c,d),x,y)"
  1.2439 +                                                            {
  1.2440 +                                                                o = octonion<T>(u,v,x,y);
  1.2441 +                                                            }
  1.2442 +                                                            else                                    // error
  1.2443 +                                                            {
  1.2444 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2445 +                                                                is.setstate(::std::ios::failbit);
  1.2446 +#else
  1.2447 +                                                                is.setstate(::std::ios_base::failbit);
  1.2448 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2449 +                                                            }
  1.2450 +                                                        }
  1.2451 +                                                        else                                    // error
  1.2452 +                                                        {
  1.2453 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2454 +                                                            is.setstate(::std::ios::failbit);
  1.2455 +#else
  1.2456 +                                                            is.setstate(::std::ios_base::failbit);
  1.2457 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2458 +                                                        }
  1.2459 +                                                    }
  1.2460 +                                                    else                                    // error
  1.2461 +                                                    {
  1.2462 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2463 +                                                        is.setstate(::std::ios::failbit);
  1.2464 +#else
  1.2465 +                                                        is.setstate(::std::ios_base::failbit);
  1.2466 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2467 +                                                    }
  1.2468 +                                                }
  1.2469 +                                                else if    (cc == ',')                        // read "((a),(e,f," (ambiguity resolution)
  1.2470 +                                                {
  1.2471 +                                                    p = ::boost::math::quaternion<T>(a);
  1.2472 +                                                    
  1.2473 +                                                    is >> g;                                // read "((a),(e,f,g" (too late to backtrack)
  1.2474 +                                                    
  1.2475 +                                                    if    (!is.good())    goto finish;
  1.2476 +                                                    
  1.2477 +                                                    is >> ch;                                // get the next lexeme
  1.2478 +                                                    
  1.2479 +                                                    if    (!is.good())    goto finish;
  1.2480 +                                                    
  1.2481 +#ifdef    BOOST_NO_STD_LOCALE
  1.2482 +                                                    cc = ch;
  1.2483 +#else
  1.2484 +                                                    cc = ct.narrow(ch, char());
  1.2485 +#endif /* BOOST_NO_STD_LOCALE */
  1.2486 +                                                    
  1.2487 +                                                    if        (cc == ')')                        // read "((a),(e,f,g)"
  1.2488 +                                                    {
  1.2489 +                                                        q = ::boost::math::quaternion<T>(c,d,g);        // "c" was actually "e", and "d" was actually "f"
  1.2490 +                                                        
  1.2491 +                                                        is >> ch;                                // get the next lexeme
  1.2492 +                                                        
  1.2493 +                                                        if    (!is.good())    goto finish;
  1.2494 +                                                        
  1.2495 +#ifdef    BOOST_NO_STD_LOCALE
  1.2496 +                                                        cc = ch;
  1.2497 +#else
  1.2498 +                                                        cc = ct.narrow(ch, char());
  1.2499 +#endif /* BOOST_NO_STD_LOCALE */
  1.2500 +                                                        
  1.2501 +                                                        if        (cc == ')')                        // read "((a),(e,f,g))"
  1.2502 +                                                        {
  1.2503 +                                                            o = octonion<T>(p,q);
  1.2504 +                                                        }
  1.2505 +                                                        else                                    // error
  1.2506 +                                                        {
  1.2507 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2508 +                                                            is.setstate(::std::ios::failbit);
  1.2509 +#else
  1.2510 +                                                            is.setstate(::std::ios_base::failbit);
  1.2511 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2512 +                                                        }
  1.2513 +                                                    }
  1.2514 +                                                    else if    (cc == ',')                        // read "((a),(e,f,g,"
  1.2515 +                                                    {
  1.2516 +                                                        is >> h;                                // read "((a),(e,f,g,h"
  1.2517 +                                                        
  1.2518 +                                                        if    (!is.good())    goto finish;
  1.2519 +                                                        
  1.2520 +                                                        is >> ch;                                // get the next lexeme
  1.2521 +                                                        
  1.2522 +                                                        if    (!is.good())    goto finish;
  1.2523 +                                                        
  1.2524 +#ifdef    BOOST_NO_STD_LOCALE
  1.2525 +                                                        cc = ch;
  1.2526 +#else
  1.2527 +                                                        cc = ct.narrow(ch, char());
  1.2528 +#endif /* BOOST_NO_STD_LOCALE */
  1.2529 +                                                        
  1.2530 +                                                        if        (cc == ')')                        // read "((a),(e,f,g,h)"
  1.2531 +                                                        {
  1.2532 +                                                            q = ::boost::math::quaternion<T>(c,d,g,h);    // "c" was actually "e", and "d" was actually "f"
  1.2533 +                                                            
  1.2534 +                                                            is >> ch;                                // get the next lexeme
  1.2535 +                                                            
  1.2536 +                                                            if    (!is.good())    goto finish;
  1.2537 +                                                            
  1.2538 +#ifdef    BOOST_NO_STD_LOCALE
  1.2539 +                                                            cc = ch;
  1.2540 +#else
  1.2541 +                                                            cc = ct.narrow(ch, char());
  1.2542 +#endif /* BOOST_NO_STD_LOCALE */
  1.2543 +                                                            
  1.2544 +                                                            if        (cc == ')')                        // read "((a),(e,f,g,h))"
  1.2545 +                                                            {
  1.2546 +                                                                o = octonion<T>(p,q);
  1.2547 +                                                            }
  1.2548 +                                                            else                                    // error
  1.2549 +                                                            {
  1.2550 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2551 +                                                                is.setstate(::std::ios::failbit);
  1.2552 +#else
  1.2553 +                                                                is.setstate(::std::ios_base::failbit);
  1.2554 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2555 +                                                            }
  1.2556 +                                                        }
  1.2557 +                                                        else                                    // error
  1.2558 +                                                        {
  1.2559 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2560 +                                                            is.setstate(::std::ios::failbit);
  1.2561 +#else
  1.2562 +                                                            is.setstate(::std::ios_base::failbit);
  1.2563 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2564 +                                                        }
  1.2565 +                                                    }
  1.2566 +                                                    else                                    // error
  1.2567 +                                                    {
  1.2568 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2569 +                                                        is.setstate(::std::ios::failbit);
  1.2570 +#else
  1.2571 +                                                        is.setstate(::std::ios_base::failbit);
  1.2572 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2573 +                                                    }
  1.2574 +                                                }
  1.2575 +                                                else                                    // error
  1.2576 +                                                {
  1.2577 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2578 +                                                    is.setstate(::std::ios::failbit);
  1.2579 +#else
  1.2580 +                                                    is.setstate(::std::ios_base::failbit);
  1.2581 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2582 +                                                }
  1.2583 +                                            }
  1.2584 +                                        }
  1.2585 +                                        else                                        // error
  1.2586 +                                        {
  1.2587 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2588 +                                            is.setstate(::std::ios::failbit);
  1.2589 +#else
  1.2590 +                                            is.setstate(::std::ios_base::failbit);
  1.2591 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2592 +                                        }
  1.2593 +                                    }
  1.2594 +                                }
  1.2595 +                                else                                        // read "((a),c" (ambiguity resolution)
  1.2596 +                                {
  1.2597 +                                    is.putback(ch);
  1.2598 +                                    
  1.2599 +                                    is >> c;                                    // we extract the third component
  1.2600 +                                    
  1.2601 +                                    if    (!is.good())    goto finish;
  1.2602 +                                    
  1.2603 +                                    is >> ch;                                    // get the next lexeme
  1.2604 +                                    
  1.2605 +                                    if    (!is.good())    goto finish;
  1.2606 +                                    
  1.2607 +#ifdef    BOOST_NO_STD_LOCALE
  1.2608 +                                    cc = ch;
  1.2609 +#else
  1.2610 +                                    cc = ct.narrow(ch, char());
  1.2611 +#endif /* BOOST_NO_STD_LOCALE */
  1.2612 +                                    
  1.2613 +                                    if        (cc == ')')                            // read "((a),c)"
  1.2614 +                                    {
  1.2615 +                                        o = octonion<T>(a,b,c);
  1.2616 +                                    }
  1.2617 +                                    else if    (cc == ',')                            // read "((a),c,"
  1.2618 +                                    {
  1.2619 +                                        is >> x;                                    // read "((a),c,x"
  1.2620 +                                        
  1.2621 +                                        if    (!is.good())    goto finish;
  1.2622 +                                        
  1.2623 +                                        is >> ch;                                    // get the next lexeme
  1.2624 +                                        
  1.2625 +                                        if    (!is.good())    goto finish;
  1.2626 +                                        
  1.2627 +#ifdef    BOOST_NO_STD_LOCALE
  1.2628 +                                        cc = ch;
  1.2629 +#else
  1.2630 +                                        cc = ct.narrow(ch, char());
  1.2631 +#endif /* BOOST_NO_STD_LOCALE */
  1.2632 +                                        
  1.2633 +                                        if        (cc == ')')                            // read "((a),c,x)"
  1.2634 +                                        {
  1.2635 +                                            o = octonion<T>(a,b,c,d,x.real(),x.imag());
  1.2636 +                                        }
  1.2637 +                                        else if    (cc == ',')                            // read "((a),c,x,"
  1.2638 +                                        {
  1.2639 +                                            is >> y;if    (!is.good())    goto finish;        // read "((a),c,x,y"
  1.2640 +                                            
  1.2641 +                                            is >> ch;                                    // get the next lexeme
  1.2642 +                                            
  1.2643 +                                            if    (!is.good())    goto finish;
  1.2644 +                                            
  1.2645 +#ifdef    BOOST_NO_STD_LOCALE
  1.2646 +                                            cc = ch;
  1.2647 +#else
  1.2648 +                                            cc = ct.narrow(ch, char());
  1.2649 +#endif /* BOOST_NO_STD_LOCALE */
  1.2650 +                                            
  1.2651 +                                            if        (cc == ')')                            // read "((a),c,x,y)"
  1.2652 +                                            {
  1.2653 +                                                o = octonion<T>(a,b,c,d,x.real(),x.imag(),y.real(),y.imag());
  1.2654 +                                            }
  1.2655 +                                            else                                        // error
  1.2656 +                                            {
  1.2657 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2658 +                                                is.setstate(::std::ios::failbit);
  1.2659 +#else
  1.2660 +                                                is.setstate(::std::ios_base::failbit);
  1.2661 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2662 +                                            }
  1.2663 +                                        }
  1.2664 +                                        else                                        // error
  1.2665 +                                        {
  1.2666 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2667 +                                            is.setstate(::std::ios::failbit);
  1.2668 +#else
  1.2669 +                                            is.setstate(::std::ios_base::failbit);
  1.2670 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2671 +                                        }
  1.2672 +                                    }
  1.2673 +                                    else                                        // error
  1.2674 +                                    {
  1.2675 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2676 +                                        is.setstate(::std::ios::failbit);
  1.2677 +#else
  1.2678 +                                        is.setstate(::std::ios_base::failbit);
  1.2679 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2680 +                                    }
  1.2681 +                                }
  1.2682 +                            }
  1.2683 +                            else                                        // error
  1.2684 +                            {
  1.2685 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2686 +                                is.setstate(::std::ios::failbit);
  1.2687 +#else
  1.2688 +                                is.setstate(::std::ios_base::failbit);
  1.2689 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2690 +                            }
  1.2691 +                        }
  1.2692 +                        else if    (cc ==',')                            // read "((a,"
  1.2693 +                        {
  1.2694 +                            is >> ch;                                    // get the next lexeme
  1.2695 +                            
  1.2696 +                            if    (!is.good())    goto finish;
  1.2697 +                            
  1.2698 +#ifdef    BOOST_NO_STD_LOCALE
  1.2699 +                            cc = ch;
  1.2700 +#else
  1.2701 +                            cc = ct.narrow(ch, char());
  1.2702 +#endif /* BOOST_NO_STD_LOCALE */
  1.2703 +                            
  1.2704 +                            if        (cc == '(')                            // read "((a,("
  1.2705 +                            {
  1.2706 +                                u = ::std::complex<T>(a);
  1.2707 +                                
  1.2708 +                                is.putback(ch);                                // can only backtrack so much
  1.2709 +                                
  1.2710 +                                is >> v;                                    // read "((a,v"
  1.2711 +                                
  1.2712 +                                if    (!is.good())    goto finish;
  1.2713 +                                
  1.2714 +                                is >> ch;                                    // get the next lexeme
  1.2715 +                                
  1.2716 +                                if    (!is.good())    goto finish;
  1.2717 +                                
  1.2718 +#ifdef    BOOST_NO_STD_LOCALE
  1.2719 +                                cc = ch;
  1.2720 +#else
  1.2721 +                                cc = ct.narrow(ch, char());
  1.2722 +#endif /* BOOST_NO_STD_LOCALE */
  1.2723 +                                
  1.2724 +                                if        (cc == ')')                            // read "((a,v)"
  1.2725 +                                {
  1.2726 +                                    is >> ch;                                    // get the next lexeme
  1.2727 +                                    
  1.2728 +                                    if    (!is.good())    goto finish;
  1.2729 +
  1.2730 +#ifdef    BOOST_NO_STD_LOCALE
  1.2731 +                                    cc = ch;
  1.2732 +#else
  1.2733 +                                    cc = ct.narrow(ch, char());
  1.2734 +#endif /* BOOST_NO_STD_LOCALE */
  1.2735 +                                    
  1.2736 +                                    if        (cc == ')')                            // read "((a,v))"
  1.2737 +                                    {
  1.2738 +                                        o = octonion<T>(u,v);
  1.2739 +                                    }
  1.2740 +                                    else if    (cc == ',')                            // read "((a,v),"
  1.2741 +                                    {
  1.2742 +                                        p = ::boost::math::quaternion<T>(u,v);
  1.2743 +                                        
  1.2744 +                                        is >> q;                                    // read "((a,v),q"
  1.2745 +                                        
  1.2746 +                                        if    (!is.good())    goto finish;
  1.2747 +                                        
  1.2748 +                                        is >> ch;                                    // get the next lexeme
  1.2749 +                                        
  1.2750 +                                        if    (!is.good())    goto finish;
  1.2751 +                                        
  1.2752 +#ifdef    BOOST_NO_STD_LOCALE
  1.2753 +                                        cc = ch;
  1.2754 +#else
  1.2755 +                                        cc = ct.narrow(ch, char());
  1.2756 +#endif /* BOOST_NO_STD_LOCALE */
  1.2757 +                                        
  1.2758 +                                        if        (cc == ')')                            // read "((a,v),q)"
  1.2759 +                                        {
  1.2760 +                                            o = octonion<T>(p,q);
  1.2761 +                                        }
  1.2762 +                                        else                                        // error
  1.2763 +                                        {
  1.2764 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2765 +                                            is.setstate(::std::ios::failbit);
  1.2766 +#else
  1.2767 +                                            is.setstate(::std::ios_base::failbit);
  1.2768 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2769 +                                        }
  1.2770 +                                    }
  1.2771 +                                    else                                        // error
  1.2772 +                                    {
  1.2773 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2774 +                                        is.setstate(::std::ios::failbit);
  1.2775 +#else
  1.2776 +                                        is.setstate(::std::ios_base::failbit);
  1.2777 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2778 +                                    }
  1.2779 +                                }
  1.2780 +                                else                                        // error
  1.2781 +                                {
  1.2782 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2783 +                                    is.setstate(::std::ios::failbit);
  1.2784 +#else
  1.2785 +                                    is.setstate(::std::ios_base::failbit);
  1.2786 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2787 +                                }
  1.2788 +                            }
  1.2789 +                            else
  1.2790 +                            {
  1.2791 +                                is.putback(ch);
  1.2792 +                                
  1.2793 +                                is >> b;                                    // read "((a,b"
  1.2794 +                                
  1.2795 +                                if    (!is.good())    goto finish;
  1.2796 +                                
  1.2797 +                                is >> ch;                                    // get the next lexeme
  1.2798 +                                
  1.2799 +                                if    (!is.good())    goto finish;
  1.2800 +                                
  1.2801 +#ifdef    BOOST_NO_STD_LOCALE
  1.2802 +                                cc = ch;
  1.2803 +#else
  1.2804 +                                cc = ct.narrow(ch, char());
  1.2805 +#endif /* BOOST_NO_STD_LOCALE */
  1.2806 +                                
  1.2807 +                                if        (cc == ')')                            // read "((a,b)"
  1.2808 +                                {
  1.2809 +                                    is >> ch;                                    // get the next lexeme
  1.2810 +                                    
  1.2811 +                                    if    (!is.good())    goto finish;
  1.2812 +                                    
  1.2813 +#ifdef    BOOST_NO_STD_LOCALE
  1.2814 +                                    cc = ch;
  1.2815 +#else
  1.2816 +                                    cc = ct.narrow(ch, char());
  1.2817 +#endif /* BOOST_NO_STD_LOCALE */
  1.2818 +                                    
  1.2819 +                                    if        (cc == ')')                            // read "((a,b))"
  1.2820 +                                    {
  1.2821 +                                        o = octonion<T>(a,b);
  1.2822 +                                    }
  1.2823 +                                    else if    (cc == ',')                            // read "((a,b),"
  1.2824 +                                    {
  1.2825 +                                        is >> ch;                                    // get the next lexeme
  1.2826 +                                        
  1.2827 +                                        if    (!is.good())    goto finish;
  1.2828 +
  1.2829 +#ifdef    BOOST_NO_STD_LOCALE
  1.2830 +                                        cc = ch;
  1.2831 +#else
  1.2832 +                                        cc = ct.narrow(ch, char());
  1.2833 +#endif /* BOOST_NO_STD_LOCALE */
  1.2834 +                                        
  1.2835 +                                        if        (cc == '(')                            // read "((a,b),("
  1.2836 +                                        {
  1.2837 +                                            is >> ch;                                    // get the next lexeme
  1.2838 +                                            
  1.2839 +                                            if    (!is.good())    goto finish;
  1.2840 +                                            
  1.2841 +#ifdef    BOOST_NO_STD_LOCALE
  1.2842 +                                            cc = ch;
  1.2843 +#else
  1.2844 +                                            cc = ct.narrow(ch, char());
  1.2845 +#endif /* BOOST_NO_STD_LOCALE */
  1.2846 +                                            
  1.2847 +                                            if        (cc == '(')                            // read "((a,b),(("
  1.2848 +                                            {
  1.2849 +                                                p = ::boost::math::quaternion<T>(a,b);
  1.2850 +                                                
  1.2851 +                                                is.putback(ch);
  1.2852 +                                                
  1.2853 +                                                is.putback(ch);                            // we backtrack twice, with the same value
  1.2854 +                                                
  1.2855 +                                                is >> q;                                // read "((a,b),q"
  1.2856 +                                                
  1.2857 +                                                if    (!is.good())    goto finish;
  1.2858 +                                                
  1.2859 +                                                is >> ch;                                    // get the next lexeme
  1.2860 +                                                
  1.2861 +                                                if    (!is.good())    goto finish;
  1.2862 +                                                
  1.2863 +#ifdef    BOOST_NO_STD_LOCALE
  1.2864 +                                                cc = ch;
  1.2865 +#else
  1.2866 +                                                cc = ct.narrow(ch, char());
  1.2867 +#endif /* BOOST_NO_STD_LOCALE */
  1.2868 +                                                
  1.2869 +                                                if        (cc == ')')                            // read "((a,b),q)"
  1.2870 +                                                {
  1.2871 +                                                    o = octonion<T>(p,q);
  1.2872 +                                                }
  1.2873 +                                                else                                        // error
  1.2874 +                                                {
  1.2875 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2876 +                                                    is.setstate(::std::ios::failbit);
  1.2877 +#else
  1.2878 +                                                    is.setstate(::std::ios_base::failbit);
  1.2879 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2880 +                                                }
  1.2881 +                                            }
  1.2882 +                                            else                                        // read "((a,b),(c" or "((a,b),(e"
  1.2883 +                                            {
  1.2884 +                                                is.putback(ch);
  1.2885 +                                                
  1.2886 +                                                is >> c;
  1.2887 +                                                
  1.2888 +                                                if    (!is.good())    goto finish;
  1.2889 +                                                
  1.2890 +                                                is >> ch;                                    // get the next lexeme
  1.2891 +                                                
  1.2892 +                                                if    (!is.good())    goto finish;
  1.2893 +                                                
  1.2894 +#ifdef    BOOST_NO_STD_LOCALE
  1.2895 +                                                cc = ch;
  1.2896 +#else
  1.2897 +                                                cc = ct.narrow(ch, char());
  1.2898 +#endif /* BOOST_NO_STD_LOCALE */
  1.2899 +                                                
  1.2900 +                                                if        (cc == ')')                            // read "((a,b),(c)" (ambiguity resolution)
  1.2901 +                                                {
  1.2902 +                                                    is >> ch;                                    // get the next lexeme
  1.2903 +                                                    
  1.2904 +                                                    if    (!is.good())    goto finish;
  1.2905 +                                                    
  1.2906 +#ifdef    BOOST_NO_STD_LOCALE
  1.2907 +                                                    cc = ch;
  1.2908 +#else
  1.2909 +                                                    cc = ct.narrow(ch, char());
  1.2910 +#endif /* BOOST_NO_STD_LOCALE */
  1.2911 +                                                    
  1.2912 +                                                    if        (cc == ')')                            // read "((a,b),(c))"
  1.2913 +                                                    {
  1.2914 +                                                        o = octonion<T>(a,b,c);
  1.2915 +                                                    }
  1.2916 +                                                    else if    (cc == ',')                            // read "((a,b),(c),"
  1.2917 +                                                    {
  1.2918 +                                                        u = ::std::complex<T>(a,b);
  1.2919 +                                                        
  1.2920 +                                                        v = ::std::complex<T>(c);
  1.2921 +                                                        
  1.2922 +                                                        is >> x;                                    // read "((a,b),(c),x"
  1.2923 +                                                        
  1.2924 +                                                        if    (!is.good())    goto finish;
  1.2925 +                                                        
  1.2926 +                                                        is >> ch;                                    // get the next lexeme
  1.2927 +                                                        
  1.2928 +                                                        if    (!is.good())    goto finish;
  1.2929 +                                                        
  1.2930 +#ifdef    BOOST_NO_STD_LOCALE
  1.2931 +                                                        cc = ch;
  1.2932 +#else
  1.2933 +                                                        cc = ct.narrow(ch, char());
  1.2934 +#endif /* BOOST_NO_STD_LOCALE */
  1.2935 +                                                        
  1.2936 +                                                        if        (cc == ')')                            // read "((a,b),(c),x)"
  1.2937 +                                                        {
  1.2938 +                                                            o = octonion<T>(u,v,x);
  1.2939 +                                                        }
  1.2940 +                                                        else if    (cc == ',')                            // read "((a,b),(c),x,"
  1.2941 +                                                        {
  1.2942 +                                                            is >> y;                                    // read "((a,b),(c),x,y"
  1.2943 +                                                            
  1.2944 +                                                            if    (!is.good())    goto finish;
  1.2945 +                                                            
  1.2946 +                                                            is >> ch;                                    // get the next lexeme
  1.2947 +                                                            
  1.2948 +                                                            if    (!is.good())    goto finish;
  1.2949 +                                                            
  1.2950 +#ifdef    BOOST_NO_STD_LOCALE
  1.2951 +                                                            cc = ch;
  1.2952 +#else
  1.2953 +                                                            cc = ct.narrow(ch, char());
  1.2954 +#endif /* BOOST_NO_STD_LOCALE */
  1.2955 +                                                            
  1.2956 +                                                            if        (cc == ')')                            // read "((a,b),(c),x,y)"
  1.2957 +                                                            {
  1.2958 +                                                                o = octonion<T>(u,v,x,y);
  1.2959 +                                                            }
  1.2960 +                                                            else                                        // error
  1.2961 +                                                            {
  1.2962 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2963 +                                                                is.setstate(::std::ios::failbit);
  1.2964 +#else
  1.2965 +                                                                is.setstate(::std::ios_base::failbit);
  1.2966 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2967 +                                                            }
  1.2968 +                                                        }
  1.2969 +                                                        else                                        // error
  1.2970 +                                                        {
  1.2971 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2972 +                                                            is.setstate(::std::ios::failbit);
  1.2973 +#else
  1.2974 +                                                            is.setstate(::std::ios_base::failbit);
  1.2975 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2976 +                                                        }
  1.2977 +                                                    }
  1.2978 +                                                    else                                        // error
  1.2979 +                                                    {
  1.2980 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.2981 +                                                        is.setstate(::std::ios::failbit);
  1.2982 +#else
  1.2983 +                                                        is.setstate(::std::ios_base::failbit);
  1.2984 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.2985 +                                                    }
  1.2986 +                                                }
  1.2987 +                                                else if    (cc == ',')                            // read "((a,b),(c," or "((a,b),(e,"
  1.2988 +                                                {
  1.2989 +                                                    is >> ch;                                    // get the next lexeme
  1.2990 +                                                    
  1.2991 +                                                    if    (!is.good())    goto finish;
  1.2992 +                                                    
  1.2993 +#ifdef    BOOST_NO_STD_LOCALE
  1.2994 +                                                    cc = ch;
  1.2995 +#else
  1.2996 +                                                    cc = ct.narrow(ch, char());
  1.2997 +#endif /* BOOST_NO_STD_LOCALE */
  1.2998 +                                                    
  1.2999 +                                                    if        (cc == '(')                            // read "((a,b),(e,(" (ambiguity resolution)
  1.3000 +                                                    {
  1.3001 +                                                        u = ::std::complex<T>(a,b);
  1.3002 +                                                        
  1.3003 +                                                        x = ::std::complex<T>(c);                    // "c" is actually "e"
  1.3004 +                                                        
  1.3005 +                                                        is.putback(ch);
  1.3006 +                                                        
  1.3007 +                                                        is >> y;                                    // read "((a,b),(e,y"
  1.3008 +                                                        
  1.3009 +                                                        if    (!is.good())    goto finish;
  1.3010 +                                                        
  1.3011 +                                                        is >> ch;                                    // get the next lexeme
  1.3012 +                                                        
  1.3013 +                                                        if    (!is.good())    goto finish;
  1.3014 +                                                        
  1.3015 +#ifdef    BOOST_NO_STD_LOCALE
  1.3016 +                                                        cc = ch;
  1.3017 +#else
  1.3018 +                                                        cc = ct.narrow(ch, char());
  1.3019 +#endif /* BOOST_NO_STD_LOCALE */
  1.3020 +                                                        
  1.3021 +                                                        if        (cc == ')')                            // read "((a,b),(e,y)"
  1.3022 +                                                        {
  1.3023 +                                                            is >> ch;                                    // get the next lexeme
  1.3024 +                                                            
  1.3025 +                                                            if    (!is.good())    goto finish;
  1.3026 +
  1.3027 +#ifdef    BOOST_NO_STD_LOCALE
  1.3028 +                                                            cc = ch;
  1.3029 +#else
  1.3030 +                                                            cc = ct.narrow(ch, char());
  1.3031 +#endif /* BOOST_NO_STD_LOCALE */
  1.3032 +                                                            
  1.3033 +                                                            if        (cc == ')')                            // read "((a,b),(e,y))"
  1.3034 +                                                            {
  1.3035 +                                                                o = octonion<T>(u,v,x,y);
  1.3036 +                                                            }
  1.3037 +                                                            else                                        // error
  1.3038 +                                                            {
  1.3039 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3040 +                                                                is.setstate(::std::ios::failbit);
  1.3041 +#else
  1.3042 +                                                                is.setstate(::std::ios_base::failbit);
  1.3043 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3044 +                                                            }
  1.3045 +                                                        }
  1.3046 +                                                        else                                        // error
  1.3047 +                                                        {
  1.3048 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3049 +                                                            is.setstate(::std::ios::failbit);
  1.3050 +#else
  1.3051 +                                                            is.setstate(::std::ios_base::failbit);
  1.3052 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3053 +                                                        }
  1.3054 +                                                    }
  1.3055 +                                                    else                                        // read "((a,b),(c,d" or "((a,b),(e,f"
  1.3056 +                                                    {
  1.3057 +                                                        is.putback(ch);
  1.3058 +                                                        
  1.3059 +                                                        is >> d;
  1.3060 +                                                        
  1.3061 +                                                        if    (!is.good())    goto finish;
  1.3062 +                                                        
  1.3063 +                                                        is >> ch;                                    // get the next lexeme
  1.3064 +                                                        
  1.3065 +                                                        if    (!is.good())    goto finish;
  1.3066 +                                                        
  1.3067 +#ifdef    BOOST_NO_STD_LOCALE
  1.3068 +                                                        cc = ch;
  1.3069 +#else
  1.3070 +                                                        cc = ct.narrow(ch, char());
  1.3071 +#endif /* BOOST_NO_STD_LOCALE */
  1.3072 +                                                        
  1.3073 +                                                        if        (cc == ')')                            // read "((a,b),(c,d)" (ambiguity resolution)
  1.3074 +                                                        {
  1.3075 +                                                            u = ::std::complex<T>(a,b);
  1.3076 +                                                            
  1.3077 +                                                            v = ::std::complex<T>(c,d);
  1.3078 +                                                            
  1.3079 +                                                            is >> ch;                                    // get the next lexeme
  1.3080 +                                                            
  1.3081 +                                                            if    (!is.good())    goto finish;
  1.3082 +                                                            
  1.3083 +#ifdef    BOOST_NO_STD_LOCALE
  1.3084 +                                                            cc = ch;
  1.3085 +#else
  1.3086 +                                                            cc = ct.narrow(ch, char());
  1.3087 +#endif /* BOOST_NO_STD_LOCALE */
  1.3088 +                                                            
  1.3089 +                                                            if        (cc == ')')                            // read "((a,b),(c,d))"
  1.3090 +                                                            {
  1.3091 +                                                                o = octonion<T>(u,v);
  1.3092 +                                                            }
  1.3093 +                                                            else if    (cc == ',')                            // read "((a,b),(c,d),"
  1.3094 +                                                            {
  1.3095 +                                                                is >> x;                                    // read "((a,b),(c,d),x
  1.3096 +                                                                
  1.3097 +                                                                if    (!is.good())    goto finish;
  1.3098 +                                                                
  1.3099 +                                                                is >> ch;                                    // get the next lexeme
  1.3100 +                                                                
  1.3101 +                                                                if    (!is.good())    goto finish;
  1.3102 +                                                                
  1.3103 +#ifdef    BOOST_NO_STD_LOCALE
  1.3104 +                                                                cc = ch;
  1.3105 +#else
  1.3106 +                                                                cc = ct.narrow(ch, char());
  1.3107 +#endif /* BOOST_NO_STD_LOCALE */
  1.3108 +                                                                
  1.3109 +                                                                if        (cc == ')')                            // read "((a,b),(c,d),x)"
  1.3110 +                                                                {
  1.3111 +                                                                    o = octonion<T>(u,v,x);
  1.3112 +                                                                }
  1.3113 +                                                                else if    (cc == ',')                            // read "((a,b),(c,d),x,"
  1.3114 +                                                                {
  1.3115 +                                                                    is >> y;                                    // read "((a,b),(c,d),x,y"
  1.3116 +                                                                    
  1.3117 +                                                                    if    (!is.good())    goto finish;
  1.3118 +                                                                    
  1.3119 +                                                                    is >> ch;                                    // get the next lexeme
  1.3120 +                                                                    
  1.3121 +                                                                    if    (!is.good())    goto finish;
  1.3122 +                                                                    
  1.3123 +#ifdef    BOOST_NO_STD_LOCALE
  1.3124 +                                                                    cc = ch;
  1.3125 +#else
  1.3126 +                                                                    cc = ct.narrow(ch, char());
  1.3127 +#endif /* BOOST_NO_STD_LOCALE */
  1.3128 +                                                                    
  1.3129 +                                                                    if        (cc == ')')                            // read "((a,b),(c,d),x,y)"
  1.3130 +                                                                    {
  1.3131 +                                                                        o = octonion<T>(u,v,x,y);
  1.3132 +                                                                    }
  1.3133 +                                                                    else                                        // error
  1.3134 +                                                                    {
  1.3135 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3136 +                                                                        is.setstate(::std::ios::failbit);
  1.3137 +#else
  1.3138 +                                                                        is.setstate(::std::ios_base::failbit);
  1.3139 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3140 +                                                                    }
  1.3141 +                                                                }
  1.3142 +                                                                else                                        // error
  1.3143 +                                                                {
  1.3144 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3145 +                                                                    is.setstate(::std::ios::failbit);
  1.3146 +#else
  1.3147 +                                                                    is.setstate(::std::ios_base::failbit);
  1.3148 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3149 +                                                                }
  1.3150 +                                                            }
  1.3151 +                                                            else                                        // error
  1.3152 +                                                            {
  1.3153 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3154 +                                                                is.setstate(::std::ios::failbit);
  1.3155 +#else
  1.3156 +                                                                is.setstate(::std::ios_base::failbit);
  1.3157 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3158 +                                                            }
  1.3159 +                                                        }
  1.3160 +                                                        else if    (cc == ',')                            // read "((a,b),(e,f," (ambiguity resolution)
  1.3161 +                                                        {
  1.3162 +                                                            p = ::boost::math::quaternion<T>(a,b);                // too late to backtrack
  1.3163 +                                                            
  1.3164 +                                                            is >> g;                                    // read "((a,b),(e,f,g"
  1.3165 +                                                            
  1.3166 +                                                            if    (!is.good())    goto finish;
  1.3167 +                                                            
  1.3168 +                                                            is >> ch;                                    // get the next lexeme
  1.3169 +                                                            
  1.3170 +                                                            if    (!is.good())    goto finish;
  1.3171 +                                                            
  1.3172 +#ifdef    BOOST_NO_STD_LOCALE
  1.3173 +                                                            cc = ch;
  1.3174 +#else
  1.3175 +                                                            cc = ct.narrow(ch, char());
  1.3176 +#endif /* BOOST_NO_STD_LOCALE */
  1.3177 +                                                            
  1.3178 +                                                            if        (cc == ')')                            // read "((a,b),(e,f,g)"
  1.3179 +                                                            {
  1.3180 +                                                                is >> ch;                                    // get the next lexeme
  1.3181 +                                                                
  1.3182 +                                                                if    (!is.good())    goto finish;
  1.3183 +                                                                
  1.3184 +#ifdef    BOOST_NO_STD_LOCALE
  1.3185 +                                                                cc = ch;
  1.3186 +#else
  1.3187 +                                                                cc = ct.narrow(ch, char());
  1.3188 +#endif /* BOOST_NO_STD_LOCALE */
  1.3189 +                                                                
  1.3190 +                                                                if        (cc == ')')                            // read "((a,b),(e,f,g))"
  1.3191 +                                                                {
  1.3192 +                                                                    q = ::boost::math::quaternion<T>(c,d,g);            // "c" is actually "e" and "d" is actually "f"
  1.3193 +                                                                    
  1.3194 +                                                                    o = octonion<T>(p,q);
  1.3195 +                                                                }
  1.3196 +                                                                else                                        // error
  1.3197 +                                                                {
  1.3198 +#if BOOST_WORKAROUND(__GNUC__, < 3)
  1.3199 +                                                                    is.setstate(::std::ios::failbit);
  1.3200 +#else
  1.3201 +                                                                    is.setstate(::std::ios_base::failbit);
  1.3202 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3203 +                                                                }
  1.3204 +                                                            }
  1.3205 +                                                            else if    (cc == ',')                            // read "((a,b),(e,f,g,"
  1.3206 +                                                            {
  1.3207 +                                                                is >> h;                                    // read "((a,b),(e,f,g,h"
  1.3208 +                                                                
  1.3209 +                                                                if    (!is.good())    goto finish;
  1.3210 +                                                                
  1.3211 +                                                                is >> ch;                                    // get the next lexeme
  1.3212 +                                                                
  1.3213 +                                                                if    (!is.good())    goto finish;
  1.3214 +                                                                
  1.3215 +#ifdef    BOOST_NO_STD_LOCALE
  1.3216 +                                                                cc = ch;
  1.3217 +#else
  1.3218 +                                                                cc = ct.narrow(ch, char());
  1.3219 +#endif /* BOOST_NO_STD_LOCALE */
  1.3220 +                                                                
  1.3221 +                                                                if        (cc == ')')                            // read "((a,b),(e,f,g,h)"
  1.3222 +                                                                {
  1.3223 +                                                                    is >> ch;                                    // get the next lexeme
  1.3224 +                                                                    
  1.3225 +                                                                    if    (!is.good())    goto finish;
  1.3226 +                                                                    
  1.3227 +#ifdef    BOOST_NO_STD_LOCALE
  1.3228 +                                                                    cc = ch;
  1.3229 +#else
  1.3230 +                                                                    cc = ct.narrow(ch, char());
  1.3231 +#endif /* BOOST_NO_STD_LOCALE */
  1.3232 +                                                                    
  1.3233 +                                                                    if        (cc == ')')                            // read ((a,b),(e,f,g,h))"
  1.3234 +                                                                    {
  1.3235 +                                                                        q = ::boost::math::quaternion<T>(c,d,g,h);            // "c" is actually "e" and "d" is actually "f"
  1.3236 +                                                                        
  1.3237 +                                                                        o = octonion<T>(p,q);
  1.3238 +                                                                    }
  1.3239 +                                                                    else                                        // error
  1.3240 +                                                                    {
  1.3241 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3242 +                                                                        is.setstate(::std::ios::failbit);
  1.3243 +#else
  1.3244 +                                                                        is.setstate(::std::ios_base::failbit);
  1.3245 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3246 +                                                                    }
  1.3247 +                                                                }
  1.3248 +                                                                else                                        // error
  1.3249 +                                                                {
  1.3250 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3251 +                                                                    is.setstate(::std::ios::failbit);
  1.3252 +#else
  1.3253 +                                                                    is.setstate(::std::ios_base::failbit);
  1.3254 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3255 +                                                                }
  1.3256 +                                                            }
  1.3257 +                                                            else                                        // error
  1.3258 +                                                            {
  1.3259 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3260 +                                                                is.setstate(::std::ios::failbit);
  1.3261 +#else
  1.3262 +                                                                is.setstate(::std::ios_base::failbit);
  1.3263 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3264 +                                                            }
  1.3265 +                                                        }
  1.3266 +                                                        else                                        // error
  1.3267 +                                                        {
  1.3268 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3269 +                                                            is.setstate(::std::ios::failbit);
  1.3270 +#else
  1.3271 +                                                            is.setstate(::std::ios_base::failbit);
  1.3272 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3273 +                                                        }
  1.3274 +                                                    }
  1.3275 +                                                }
  1.3276 +                                                else                                        // error
  1.3277 +                                                {
  1.3278 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3279 +                                                    is.setstate(::std::ios::failbit);
  1.3280 +#else
  1.3281 +                                                    is.setstate(::std::ios_base::failbit);
  1.3282 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3283 +                                                }
  1.3284 +                                            }
  1.3285 +                                        }
  1.3286 +                                        else                                        // error
  1.3287 +                                        {
  1.3288 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3289 +                                            is.setstate(::std::ios::failbit);
  1.3290 +#else
  1.3291 +                                            is.setstate(::std::ios_base::failbit);
  1.3292 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3293 +                                        }
  1.3294 +                                    }
  1.3295 +                                    else                                        // error
  1.3296 +                                    {
  1.3297 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3298 +                                        is.setstate(::std::ios::failbit);
  1.3299 +#else
  1.3300 +                                        is.setstate(::std::ios_base::failbit);
  1.3301 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3302 +                                    }
  1.3303 +                                }
  1.3304 +                                else if    (cc == ',')                            // read "((a,b,"
  1.3305 +                                {
  1.3306 +                                    is >> c;                                    // read "((a,b,c"
  1.3307 +                                    
  1.3308 +                                    if    (!is.good())    goto finish;
  1.3309 +                                    
  1.3310 +                                    is >> ch;                                    // get the next lexeme
  1.3311 +                                                                
  1.3312 +                                    if    (!is.good())    goto finish;
  1.3313 +                                    
  1.3314 +#ifdef    BOOST_NO_STD_LOCALE
  1.3315 +                                    cc = ch;
  1.3316 +#else
  1.3317 +                                    cc = ct.narrow(ch, char());
  1.3318 +#endif /* BOOST_NO_STD_LOCALE */
  1.3319 +                                    
  1.3320 +                                    if        (cc == ')')                            // read "((a,b,c)"
  1.3321 +                                    {
  1.3322 +                                        is >> ch;                                    // get the next lexeme
  1.3323 +                                                                    
  1.3324 +                                        if    (!is.good())    goto finish;
  1.3325 +                                        
  1.3326 +#ifdef    BOOST_NO_STD_LOCALE
  1.3327 +                                        cc = ch;
  1.3328 +#else
  1.3329 +                                        cc = ct.narrow(ch, char());
  1.3330 +#endif /* BOOST_NO_STD_LOCALE */
  1.3331 +                                        
  1.3332 +                                        if        (cc == ')')                            // read "((a,b,c))"
  1.3333 +                                        {
  1.3334 +                                            o = octonion<T>(a,b,c);
  1.3335 +                                        }
  1.3336 +                                        else if    (cc == ',')                            // read "((a,b,c),"
  1.3337 +                                        {
  1.3338 +                                            p = ::boost::math::quaternion<T>(a,b,c);
  1.3339 +                                            
  1.3340 +                                            is >> q;                                    // read "((a,b,c),q"
  1.3341 +                                            
  1.3342 +                                            if    (!is.good())    goto finish;
  1.3343 +                                            
  1.3344 +                                            is >> ch;                                    // get the next lexeme
  1.3345 +                                                                        
  1.3346 +                                            if    (!is.good())    goto finish;
  1.3347 +                                            
  1.3348 +#ifdef    BOOST_NO_STD_LOCALE
  1.3349 +                                            cc = ch;
  1.3350 +#else
  1.3351 +                                            cc = ct.narrow(ch, char());
  1.3352 +#endif /* BOOST_NO_STD_LOCALE */
  1.3353 +                                            
  1.3354 +                                            if        (cc == ')')                            // read "((a,b,c),q)"
  1.3355 +                                            {
  1.3356 +                                                o = octonion<T>(p,q);
  1.3357 +                                            }
  1.3358 +                                            else                                        // error
  1.3359 +                                            {
  1.3360 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3361 +                                                is.setstate(::std::ios::failbit);
  1.3362 +#else
  1.3363 +                                                is.setstate(::std::ios_base::failbit);
  1.3364 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3365 +                                            }
  1.3366 +                                        }
  1.3367 +                                        else                                        // error
  1.3368 +                                        {
  1.3369 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3370 +                                            is.setstate(::std::ios::failbit);
  1.3371 +#else
  1.3372 +                                            is.setstate(::std::ios_base::failbit);
  1.3373 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3374 +                                        }
  1.3375 +                                    }
  1.3376 +                                    else if    (cc == ',')                            // read "((a,b,c,"
  1.3377 +                                    {
  1.3378 +                                        is >> d;                                    // read "((a,b,c,d"
  1.3379 +                                        
  1.3380 +                                        if    (!is.good())    goto finish;
  1.3381 +                                        
  1.3382 +                                        is >> ch;                                    // get the next lexeme
  1.3383 +                                                                    
  1.3384 +                                        if    (!is.good())    goto finish;
  1.3385 +                                        
  1.3386 +#ifdef    BOOST_NO_STD_LOCALE
  1.3387 +                                        cc = ch;
  1.3388 +#else
  1.3389 +                                        cc = ct.narrow(ch, char());
  1.3390 +#endif /* BOOST_NO_STD_LOCALE */
  1.3391 +                                        
  1.3392 +                                        if        (cc == ')')                            // read "((a,b,c,d)"
  1.3393 +                                        {
  1.3394 +                                            is >> ch;                                    // get the next lexeme
  1.3395 +                                                                        
  1.3396 +                                            if    (!is.good())    goto finish;
  1.3397 +                                            
  1.3398 +#ifdef    BOOST_NO_STD_LOCALE
  1.3399 +                                            cc = ch;
  1.3400 +#else
  1.3401 +                                            cc = ct.narrow(ch, char());
  1.3402 +#endif /* BOOST_NO_STD_LOCALE */
  1.3403 +                                            
  1.3404 +                                            if        (cc == ')')                            // read "((a,b,c,d))"
  1.3405 +                                            {
  1.3406 +                                                o = octonion<T>(a,b,c,d);
  1.3407 +                                            }
  1.3408 +                                            else if    (cc == ',')                            // read "((a,b,c,d),"
  1.3409 +                                            {
  1.3410 +                                                p = ::boost::math::quaternion<T>(a,b,c,d);
  1.3411 +                                                
  1.3412 +                                                is >> q;                                    // read "((a,b,c,d),q"
  1.3413 +                                                
  1.3414 +                                                if    (!is.good())    goto finish;
  1.3415 +                                                
  1.3416 +                                                is >> ch;                                    // get the next lexeme
  1.3417 +                                                                            
  1.3418 +                                                if    (!is.good())    goto finish;
  1.3419 +                                                
  1.3420 +#ifdef    BOOST_NO_STD_LOCALE
  1.3421 +                                                cc = ch;
  1.3422 +#else
  1.3423 +                                                cc = ct.narrow(ch, char());
  1.3424 +#endif /* BOOST_NO_STD_LOCALE */
  1.3425 +                                                
  1.3426 +                                                if        (cc == ')')                            // read "((a,b,c,d),q)"
  1.3427 +                                                {
  1.3428 +                                                    o = octonion<T>(p,q);
  1.3429 +                                                }
  1.3430 +                                                else                                        // error
  1.3431 +                                                {
  1.3432 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3433 +                                                    is.setstate(::std::ios::failbit);
  1.3434 +#else
  1.3435 +                                                    is.setstate(::std::ios_base::failbit);
  1.3436 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3437 +                                                }
  1.3438 +                                            }
  1.3439 +                                            else                                        // error
  1.3440 +                                            {
  1.3441 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3442 +                                                is.setstate(::std::ios::failbit);
  1.3443 +#else
  1.3444 +                                                is.setstate(::std::ios_base::failbit);
  1.3445 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3446 +                                            }
  1.3447 +                                        }
  1.3448 +                                        else                                        // error
  1.3449 +                                        {
  1.3450 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3451 +                                            is.setstate(::std::ios::failbit);
  1.3452 +#else
  1.3453 +                                            is.setstate(::std::ios_base::failbit);
  1.3454 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3455 +                                        }
  1.3456 +                                    }
  1.3457 +                                    else                                        // error
  1.3458 +                                    {
  1.3459 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3460 +                                        is.setstate(::std::ios::failbit);
  1.3461 +#else
  1.3462 +                                        is.setstate(::std::ios_base::failbit);
  1.3463 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3464 +                                    }
  1.3465 +                                }
  1.3466 +                                else                                        // error
  1.3467 +                                {
  1.3468 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3469 +                                    is.setstate(::std::ios::failbit);
  1.3470 +#else
  1.3471 +                                    is.setstate(::std::ios_base::failbit);
  1.3472 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3473 +                                }
  1.3474 +                            }
  1.3475 +                        }
  1.3476 +                        else                                        // error
  1.3477 +                        {
  1.3478 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3479 +                            is.setstate(::std::ios::failbit);
  1.3480 +#else
  1.3481 +                            is.setstate(::std::ios_base::failbit);
  1.3482 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3483 +                        }
  1.3484 +                    }
  1.3485 +                }
  1.3486 +                else                                        // read "(a"
  1.3487 +                {
  1.3488 +                    is.putback(ch);
  1.3489 +                    
  1.3490 +                    is >> a;                                    // we extract the first component
  1.3491 +                    
  1.3492 +                    if    (!is.good())    goto finish;
  1.3493 +                    
  1.3494 +                    is >> ch;                                    // get the next lexeme
  1.3495 +                                                
  1.3496 +                    if    (!is.good())    goto finish;
  1.3497 +                    
  1.3498 +#ifdef    BOOST_NO_STD_LOCALE
  1.3499 +                    cc = ch;
  1.3500 +#else
  1.3501 +                    cc = ct.narrow(ch, char());
  1.3502 +#endif /* BOOST_NO_STD_LOCALE */
  1.3503 +                    
  1.3504 +                    if        (cc == ')')                            // read "(a)"
  1.3505 +                    {
  1.3506 +                        o = octonion<T>(a);
  1.3507 +                    }
  1.3508 +                    else if    (cc == ',')                            // read "(a,"
  1.3509 +                    {
  1.3510 +                        is >> ch;                                    // get the next lexeme
  1.3511 +                                                    
  1.3512 +                        if    (!is.good())    goto finish;
  1.3513 +                        
  1.3514 +#ifdef    BOOST_NO_STD_LOCALE
  1.3515 +                        cc = ch;
  1.3516 +#else
  1.3517 +                        cc = ct.narrow(ch, char());
  1.3518 +#endif /* BOOST_NO_STD_LOCALE */
  1.3519 +                        
  1.3520 +                        if        (cc == '(')                            // read "(a,("
  1.3521 +                        {
  1.3522 +                            is >> ch;                                    // get the next lexeme
  1.3523 +                                                        
  1.3524 +                            if    (!is.good())    goto finish;
  1.3525 +
  1.3526 +#ifdef    BOOST_NO_STD_LOCALE
  1.3527 +                            cc = ch;
  1.3528 +#else
  1.3529 +                            cc = ct.narrow(ch, char());
  1.3530 +#endif /* BOOST_NO_STD_LOCALE */
  1.3531 +                            
  1.3532 +                            if        (cc == '(')                            // read "(a,(("
  1.3533 +                            {
  1.3534 +                                p = ::boost::math::quaternion<T>(a);
  1.3535 +                                
  1.3536 +                                is.putback(ch);
  1.3537 +                                
  1.3538 +                                is.putback(ch);                                // we backtrack twice, with the same value
  1.3539 +                                
  1.3540 +                                is >> q;                                    // read "(a,q"
  1.3541 +                                
  1.3542 +                                if    (!is.good())    goto finish;
  1.3543 +                                
  1.3544 +                                is >> ch;                                    // get the next lexeme
  1.3545 +                                                            
  1.3546 +                                if    (!is.good())    goto finish;
  1.3547 +                                
  1.3548 +#ifdef    BOOST_NO_STD_LOCALE
  1.3549 +                                cc = ch;
  1.3550 +#else
  1.3551 +                                cc = ct.narrow(ch, char());
  1.3552 +#endif /* BOOST_NO_STD_LOCALE */
  1.3553 +                                
  1.3554 +                                if        (cc == ')')                            // read "(a,q)"
  1.3555 +                                {
  1.3556 +                                    o = octonion<T>(p,q);
  1.3557 +                                }
  1.3558 +                                else                                        // error
  1.3559 +                                {
  1.3560 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3561 +                                    is.setstate(::std::ios::failbit);
  1.3562 +#else
  1.3563 +                                    is.setstate(::std::ios_base::failbit);
  1.3564 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3565 +                                }
  1.3566 +                            }
  1.3567 +                            else                                        // read "(a,(c" or "(a,(e"
  1.3568 +                            {
  1.3569 +                                is.putback(ch);
  1.3570 +                                
  1.3571 +                                is >> c;
  1.3572 +                                
  1.3573 +                                if    (!is.good())    goto finish;
  1.3574 +                                
  1.3575 +                                is >> ch;                                    // get the next lexeme
  1.3576 +                                                            
  1.3577 +                                if    (!is.good())    goto finish;
  1.3578 +                                
  1.3579 +#ifdef    BOOST_NO_STD_LOCALE
  1.3580 +                                cc = ch;
  1.3581 +#else
  1.3582 +                                cc = ct.narrow(ch, char());
  1.3583 +#endif /* BOOST_NO_STD_LOCALE */
  1.3584 +                                
  1.3585 +                                if        (cc == ')')                            // read "(a,(c)" (ambiguity resolution)
  1.3586 +                                {
  1.3587 +                                    is >> ch;                                    // get the next lexeme
  1.3588 +                                                                
  1.3589 +                                    if    (!is.good())    goto finish;
  1.3590 +                                    
  1.3591 +#ifdef    BOOST_NO_STD_LOCALE
  1.3592 +                                    cc = ch;
  1.3593 +#else
  1.3594 +                                    cc = ct.narrow(ch, char());
  1.3595 +#endif /* BOOST_NO_STD_LOCALE */
  1.3596 +                                    
  1.3597 +                                    if        (cc == ')')                            // read "(a,(c))"
  1.3598 +                                    {
  1.3599 +                                        o = octonion<T>(a,b,c);
  1.3600 +                                    }
  1.3601 +                                    else if    (cc == ',')                            // read "(a,(c),"
  1.3602 +                                    {
  1.3603 +                                        u = ::std::complex<T>(a);
  1.3604 +                                        
  1.3605 +                                        v = ::std::complex<T>(c);
  1.3606 +                                        
  1.3607 +                                        is >> x;                                // read "(a,(c),x"
  1.3608 +                                        
  1.3609 +                                        if    (!is.good())    goto finish;
  1.3610 +                                        
  1.3611 +                                        is >> ch;                                    // get the next lexeme
  1.3612 +                                                                    
  1.3613 +                                        if    (!is.good())    goto finish;
  1.3614 +
  1.3615 +#ifdef    BOOST_NO_STD_LOCALE
  1.3616 +                                        cc = ch;
  1.3617 +#else
  1.3618 +                                        cc = ct.narrow(ch, char());
  1.3619 +#endif /* BOOST_NO_STD_LOCALE */
  1.3620 +                                        
  1.3621 +                                        if        (cc == ')')                            // read "(a,(c),x)"
  1.3622 +                                        {
  1.3623 +                                            o = octonion<T>(u,v,x);
  1.3624 +                                        }
  1.3625 +                                        else if    (cc == ',')                            // read "(a,(c),x,"
  1.3626 +                                        {
  1.3627 +                                            is >> y;                                    // read "(a,(c),x,y"
  1.3628 +                                            
  1.3629 +                                            if    (!is.good())    goto finish;
  1.3630 +                                            
  1.3631 +                                            is >> ch;                                    // get the next lexeme
  1.3632 +                                                                        
  1.3633 +                                            if    (!is.good())    goto finish;
  1.3634 +                                            
  1.3635 +#ifdef    BOOST_NO_STD_LOCALE
  1.3636 +                                            cc = ch;
  1.3637 +#else
  1.3638 +                                            cc = ct.narrow(ch, char());
  1.3639 +#endif /* BOOST_NO_STD_LOCALE */
  1.3640 +                                            
  1.3641 +                                            if        (cc == ')')                            // read "(a,(c),x,y)"
  1.3642 +                                            {
  1.3643 +                                                o = octonion<T>(u,v,x,y);
  1.3644 +                                            }
  1.3645 +                                            else                                        // error
  1.3646 +                                            {
  1.3647 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3648 +                                                is.setstate(::std::ios::failbit);
  1.3649 +#else
  1.3650 +                                                is.setstate(::std::ios_base::failbit);
  1.3651 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3652 +                                            }
  1.3653 +                                        }
  1.3654 +                                        else                                        // error
  1.3655 +                                        {
  1.3656 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3657 +                                            is.setstate(::std::ios::failbit);
  1.3658 +#else
  1.3659 +                                            is.setstate(::std::ios_base::failbit);
  1.3660 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3661 +                                        }
  1.3662 +                                    }
  1.3663 +                                    else                                        // error
  1.3664 +                                    {
  1.3665 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3666 +                                        is.setstate(::std::ios::failbit);
  1.3667 +#else
  1.3668 +                                        is.setstate(::std::ios_base::failbit);
  1.3669 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3670 +                                    }
  1.3671 +                                }
  1.3672 +                                else if    (cc == ',')                            // read "(a,(c," or "(a,(e,"
  1.3673 +                                {
  1.3674 +                                    is >> ch;                                    // get the next lexeme
  1.3675 +                                                                
  1.3676 +                                    if    (!is.good())    goto finish;
  1.3677 +                                    
  1.3678 +#ifdef    BOOST_NO_STD_LOCALE
  1.3679 +                                    cc = ch;
  1.3680 +#else
  1.3681 +                                    cc = ct.narrow(ch, char());
  1.3682 +#endif /* BOOST_NO_STD_LOCALE */
  1.3683 +                                    
  1.3684 +                                    if        (cc == '(')                            // read "(a,(e,(" (ambiguity resolution)
  1.3685 +                                    {
  1.3686 +                                        u = ::std::complex<T>(a);
  1.3687 +                                        
  1.3688 +                                        x = ::std::complex<T>(c);                // "c" is actually "e"
  1.3689 +                                        
  1.3690 +                                        is.putback(ch);                            // we backtrack
  1.3691 +                                        
  1.3692 +                                        is >> y;                                // read "(a,(e,y"
  1.3693 +                                        
  1.3694 +                                        if    (!is.good())    goto finish;
  1.3695 +                                        
  1.3696 +                                        is >> ch;                                    // get the next lexeme
  1.3697 +                                                                    
  1.3698 +                                        if    (!is.good())    goto finish;
  1.3699 +                                        
  1.3700 +#ifdef    BOOST_NO_STD_LOCALE
  1.3701 +                                        cc = ch;
  1.3702 +#else
  1.3703 +                                        cc = ct.narrow(ch, char());
  1.3704 +#endif /* BOOST_NO_STD_LOCALE */
  1.3705 +                                        
  1.3706 +                                        if        (cc == ')')                            // read "(a,(e,y)"
  1.3707 +                                        {
  1.3708 +                                            is >> ch;                                    // get the next lexeme
  1.3709 +                                                                        
  1.3710 +                                            if    (!is.good())    goto finish;
  1.3711 +                                            
  1.3712 +#ifdef    BOOST_NO_STD_LOCALE
  1.3713 +                                            cc = ch;
  1.3714 +#else
  1.3715 +                                            cc = ct.narrow(ch, char());
  1.3716 +#endif /* BOOST_NO_STD_LOCALE */
  1.3717 +                                            
  1.3718 +                                            if        (cc == ')')                            // read "(a,(e,y))"
  1.3719 +                                            {
  1.3720 +                                                o = octonion<T>(u,v,x,y);
  1.3721 +                                            }
  1.3722 +                                            else                                        // error
  1.3723 +                                            {
  1.3724 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3725 +                                                is.setstate(::std::ios::failbit);
  1.3726 +#else
  1.3727 +                                                is.setstate(::std::ios_base::failbit);
  1.3728 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3729 +                                            }
  1.3730 +                                        }
  1.3731 +                                        else                                        // error
  1.3732 +                                        {
  1.3733 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3734 +                                            is.setstate(::std::ios::failbit);
  1.3735 +#else
  1.3736 +                                            is.setstate(::std::ios_base::failbit);
  1.3737 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3738 +                                        }
  1.3739 +                                    }
  1.3740 +                                    else                                        // read "(a,(c,d" or "(a,(e,f"
  1.3741 +                                    {
  1.3742 +                                        is.putback(ch);
  1.3743 +                                        
  1.3744 +                                        is >> d;
  1.3745 +                                        
  1.3746 +                                        if    (!is.good())    goto finish;
  1.3747 +                                        
  1.3748 +                                        is >> ch;                                    // get the next lexeme
  1.3749 +                                                                    
  1.3750 +                                        if    (!is.good())    goto finish;
  1.3751 +                                        
  1.3752 +#ifdef    BOOST_NO_STD_LOCALE
  1.3753 +                                        cc = ch;
  1.3754 +#else
  1.3755 +                                        cc = ct.narrow(ch, char());
  1.3756 +#endif /* BOOST_NO_STD_LOCALE */
  1.3757 +                                        
  1.3758 +                                        if        (cc == ')')                            // read "(a,(c,d)" (ambiguity resolution)
  1.3759 +                                        {
  1.3760 +                                            is >> ch;                                    // get the next lexeme
  1.3761 +                                                                        
  1.3762 +                                            if    (!is.good())    goto finish;
  1.3763 +                                            
  1.3764 +#ifdef    BOOST_NO_STD_LOCALE
  1.3765 +                                            cc = ch;
  1.3766 +#else
  1.3767 +                                            cc = ct.narrow(ch, char());
  1.3768 +#endif /* BOOST_NO_STD_LOCALE */
  1.3769 +                                            
  1.3770 +                                            if        (cc == ')')                            // read "(a,(c,d))"
  1.3771 +                                            {
  1.3772 +                                                o = octonion<T>(a,b,c,d);
  1.3773 +                                            }
  1.3774 +                                            else if    (cc == ',')                            // read "(a,(c,d),"
  1.3775 +                                            {
  1.3776 +                                                u = ::std::complex<T>(a);
  1.3777 +                                                
  1.3778 +                                                v = ::std::complex<T>(c,d);
  1.3779 +                                                
  1.3780 +                                                is >> x;                                // read "(a,(c,d),x"
  1.3781 +                                                
  1.3782 +                                                if    (!is.good())    goto finish;
  1.3783 +                                                
  1.3784 +                                                is >> ch;                                    // get the next lexeme
  1.3785 +                                                                            
  1.3786 +                                                if    (!is.good())    goto finish;
  1.3787 +                                                
  1.3788 +#ifdef    BOOST_NO_STD_LOCALE
  1.3789 +                                                cc = ch;
  1.3790 +#else
  1.3791 +                                                cc = ct.narrow(ch, char());
  1.3792 +#endif /* BOOST_NO_STD_LOCALE */
  1.3793 +                                                
  1.3794 +                                                if        (cc == ')')                            // read "(a,(c,d),x)"
  1.3795 +                                                {
  1.3796 +                                                    o = octonion<T>(u,v,x);
  1.3797 +                                                }
  1.3798 +                                                else if    (cc == ',')                            // read "(a,(c,d),x,"
  1.3799 +                                                {
  1.3800 +                                                    is >> y;                                    // read "(a,(c,d),x,y"
  1.3801 +                                                    
  1.3802 +                                                    if    (!is.good())    goto finish;
  1.3803 +                                                    
  1.3804 +                                                    is >> ch;                                    // get the next lexeme
  1.3805 +                                                                                
  1.3806 +                                                    if    (!is.good())    goto finish;
  1.3807 +                                                    
  1.3808 +#ifdef    BOOST_NO_STD_LOCALE
  1.3809 +                                                    cc = ch;
  1.3810 +#else
  1.3811 +                                                    cc = ct.narrow(ch, char());
  1.3812 +#endif /* BOOST_NO_STD_LOCALE */
  1.3813 +                                                    
  1.3814 +                                                    if        (cc == ')')                            // read "(a,(c,d),x,y)"
  1.3815 +                                                    {
  1.3816 +                                                        o = octonion<T>(u,v,x,y);
  1.3817 +                                                    }
  1.3818 +                                                    else                                        // error
  1.3819 +                                                    {
  1.3820 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3821 +                                                        is.setstate(::std::ios::failbit);
  1.3822 +#else
  1.3823 +                                                        is.setstate(::std::ios_base::failbit);
  1.3824 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3825 +                                                    }
  1.3826 +                                                }
  1.3827 +                                                else                                        // error
  1.3828 +                                                {
  1.3829 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3830 +                                                    is.setstate(::std::ios::failbit);
  1.3831 +#else
  1.3832 +                                                    is.setstate(::std::ios_base::failbit);
  1.3833 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3834 +                                                }
  1.3835 +                                            }
  1.3836 +                                            else                                        // error
  1.3837 +                                            {
  1.3838 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3839 +                                                is.setstate(::std::ios::failbit);
  1.3840 +#else
  1.3841 +                                                is.setstate(::std::ios_base::failbit);
  1.3842 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3843 +                                            }
  1.3844 +                                        }
  1.3845 +                                        else if    (cc == ',')                            // read "(a,(e,f," (ambiguity resolution)
  1.3846 +                                        {
  1.3847 +                                            p = ::boost::math::quaternion<T>(a);
  1.3848 +                                            
  1.3849 +                                            is >> g;                                    // read "(a,(e,f,g"
  1.3850 +                                            
  1.3851 +                                            if    (!is.good())    goto finish;
  1.3852 +                                            
  1.3853 +                                            is >> ch;                                    // get the next lexeme
  1.3854 +                                                                        
  1.3855 +                                            if    (!is.good())    goto finish;
  1.3856 +                                            
  1.3857 +#ifdef    BOOST_NO_STD_LOCALE
  1.3858 +                                            cc = ch;
  1.3859 +#else
  1.3860 +                                            cc = ct.narrow(ch, char());
  1.3861 +#endif /* BOOST_NO_STD_LOCALE */
  1.3862 +                                            
  1.3863 +                                            if        (cc == ')')                            // read "(a,(e,f,g)"
  1.3864 +                                            {
  1.3865 +                                                is >> ch;                                    // get the next lexeme
  1.3866 +                                                                            
  1.3867 +                                                if    (!is.good())    goto finish;
  1.3868 +                                                
  1.3869 +#ifdef    BOOST_NO_STD_LOCALE
  1.3870 +                                                cc = ch;
  1.3871 +#else
  1.3872 +                                                cc = ct.narrow(ch, char());
  1.3873 +#endif /* BOOST_NO_STD_LOCALE */
  1.3874 +                                                
  1.3875 +                                                if        (cc == ')')                            // read "(a,(e,f,g))"
  1.3876 +                                                {
  1.3877 +                                                    q = ::boost::math::quaternion<T>(c,d,g);            // "c" is actually "e" and "d" is actually "f"
  1.3878 +                                                    
  1.3879 +                                                    o = octonion<T>(p,q);
  1.3880 +                                                }
  1.3881 +                                                else                                        // error
  1.3882 +                                                {
  1.3883 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3884 +                                                    is.setstate(::std::ios::failbit);
  1.3885 +#else
  1.3886 +                                                    is.setstate(::std::ios_base::failbit);
  1.3887 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3888 +                                                }
  1.3889 +                                            }
  1.3890 +                                            else if    (cc == ',')                            // read "(a,(e,f,g,"
  1.3891 +                                            {
  1.3892 +                                                is >> h;                                    // read "(a,(e,f,g,h"
  1.3893 +                                                
  1.3894 +                                                if    (!is.good())    goto finish;
  1.3895 +                                                
  1.3896 +                                                is >> ch;                                    // get the next lexeme
  1.3897 +                                                                            
  1.3898 +                                                if    (!is.good())    goto finish;
  1.3899 +                                                
  1.3900 +#ifdef    BOOST_NO_STD_LOCALE
  1.3901 +                                                cc = ch;
  1.3902 +#else
  1.3903 +                                                cc = ct.narrow(ch, char());
  1.3904 +#endif /* BOOST_NO_STD_LOCALE */
  1.3905 +                                                
  1.3906 +                                                if        (cc == ')')                            // read "(a,(e,f,g,h)"
  1.3907 +                                                {
  1.3908 +                                                    is >> ch;                                    // get the next lexeme
  1.3909 +                                                                                
  1.3910 +                                                    if    (!is.good())    goto finish;
  1.3911 +                                                    
  1.3912 +#ifdef    BOOST_NO_STD_LOCALE
  1.3913 +                                                    cc = ch;
  1.3914 +#else
  1.3915 +                                                    cc = ct.narrow(ch, char());
  1.3916 +#endif /* BOOST_NO_STD_LOCALE */
  1.3917 +                                                    
  1.3918 +                                                    if        (cc == ')')                            // read "(a,(e,f,g,h))"
  1.3919 +                                                    {
  1.3920 +                                                        q = ::boost::math::quaternion<T>(c,d,g,h);            // "c" is actually "e" and "d" is actually "f"
  1.3921 +                                                        
  1.3922 +                                                        o = octonion<T>(p,q);
  1.3923 +                                                    }
  1.3924 +                                                    else                                        // error
  1.3925 +                                                    {
  1.3926 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3927 +                                                        is.setstate(::std::ios::failbit);
  1.3928 +#else
  1.3929 +                                                        is.setstate(::std::ios_base::failbit);
  1.3930 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3931 +                                                    }
  1.3932 +                                                }
  1.3933 +                                                else                                        // error
  1.3934 +                                                {
  1.3935 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3936 +                                                    is.setstate(::std::ios::failbit);
  1.3937 +#else
  1.3938 +                                                    is.setstate(::std::ios_base::failbit);
  1.3939 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3940 +                                                }
  1.3941 +                                            }
  1.3942 +                                            else                                        // error
  1.3943 +                                            {
  1.3944 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3945 +                                                is.setstate(::std::ios::failbit);
  1.3946 +#else
  1.3947 +                                                is.setstate(::std::ios_base::failbit);
  1.3948 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3949 +                                            }
  1.3950 +                                        }
  1.3951 +                                        else                                        // error
  1.3952 +                                        {
  1.3953 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3954 +                                            is.setstate(::std::ios::failbit);
  1.3955 +#else
  1.3956 +                                            is.setstate(::std::ios_base::failbit);
  1.3957 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3958 +                                        }
  1.3959 +                                    }
  1.3960 +                                }
  1.3961 +                                else                                        // error
  1.3962 +                                {
  1.3963 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.3964 +                                    is.setstate(::std::ios::failbit);
  1.3965 +#else
  1.3966 +                                    is.setstate(::std::ios_base::failbit);
  1.3967 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.3968 +                                }
  1.3969 +                            }
  1.3970 +                        }
  1.3971 +                        else                                        // read "(a,b" or "(a,c" (ambiguity resolution)
  1.3972 +                        {
  1.3973 +                            is.putback(ch);
  1.3974 +                            
  1.3975 +                            is >> b;
  1.3976 +                            
  1.3977 +                            if    (!is.good())    goto finish;
  1.3978 +                            
  1.3979 +                            is >> ch;                                    // get the next lexeme
  1.3980 +                                                        
  1.3981 +                            if    (!is.good())    goto finish;
  1.3982 +                            
  1.3983 +#ifdef    BOOST_NO_STD_LOCALE
  1.3984 +                            cc = ch;
  1.3985 +#else
  1.3986 +                            cc = ct.narrow(ch, char());
  1.3987 +#endif /* BOOST_NO_STD_LOCALE */
  1.3988 +                            
  1.3989 +                            if        (cc == ')')                            // read "(a,b)" (ambiguity resolution)
  1.3990 +                            {
  1.3991 +                                o = octonion<T>(a,b);
  1.3992 +                            }
  1.3993 +                            else if    (cc == ',')                            // read "(a,b," or "(a,c,"
  1.3994 +                            {
  1.3995 +                                is >> ch;                                    // get the next lexeme
  1.3996 +                                                            
  1.3997 +                                if    (!is.good())    goto finish;
  1.3998 +                                
  1.3999 +#ifdef    BOOST_NO_STD_LOCALE
  1.4000 +                                cc = ch;
  1.4001 +#else
  1.4002 +                                cc = ct.narrow(ch, char());
  1.4003 +#endif /* BOOST_NO_STD_LOCALE */
  1.4004 +                                
  1.4005 +                                if        (cc == '(')                            // read "(a,c,(" (ambiguity resolution)
  1.4006 +                                {
  1.4007 +                                    u = ::std::complex<T>(a);
  1.4008 +                                    
  1.4009 +                                    v = ::std::complex<T>(b);                    // "b" is actually "c"
  1.4010 +                                    
  1.4011 +                                    is.putback(ch);                                // we backtrack
  1.4012 +                                    
  1.4013 +                                    is >> x;                                    // read "(a,c,x"
  1.4014 +                                    
  1.4015 +                                    if    (!is.good())    goto finish;
  1.4016 +                                    
  1.4017 +                                    is >> ch;                                    // get the next lexeme
  1.4018 +                                                                
  1.4019 +                                    if    (!is.good())    goto finish;
  1.4020 +                                    
  1.4021 +#ifdef    BOOST_NO_STD_LOCALE
  1.4022 +                                    cc = ch;
  1.4023 +#else
  1.4024 +                                    cc = ct.narrow(ch, char());
  1.4025 +#endif /* BOOST_NO_STD_LOCALE */
  1.4026 +                                    
  1.4027 +                                    if        (cc == ')')                            // read "(a,c,x)"
  1.4028 +                                    {
  1.4029 +                                        o = octonion<T>(u,v,x);
  1.4030 +                                    }
  1.4031 +                                    else if    (cc == ',')                            // read "(a,c,x,"
  1.4032 +                                    {
  1.4033 +                                        is >> y;                                    // read "(a,c,x,y"                                    // read "(a,c,x"
  1.4034 +                                        
  1.4035 +                                        if    (!is.good())    goto finish;
  1.4036 +                                        
  1.4037 +                                        is >> ch;                                    // get the next lexeme
  1.4038 +                                                                    
  1.4039 +                                        if    (!is.good())    goto finish;
  1.4040 +                                        
  1.4041 +#ifdef    BOOST_NO_STD_LOCALE
  1.4042 +                                        cc = ch;
  1.4043 +#else
  1.4044 +                                        cc = ct.narrow(ch, char());
  1.4045 +#endif /* BOOST_NO_STD_LOCALE */
  1.4046 +                                        
  1.4047 +                                        if        (cc == ')')                            // read "(a,c,x,y)"
  1.4048 +                                        {
  1.4049 +                                            o = octonion<T>(u,v,x,y);
  1.4050 +                                        }
  1.4051 +                                        else                                        // error
  1.4052 +                                        {
  1.4053 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4054 +                                            is.setstate(::std::ios::failbit);
  1.4055 +#else
  1.4056 +                                            is.setstate(::std::ios_base::failbit);
  1.4057 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4058 +                                        }
  1.4059 +                                    }
  1.4060 +                                    else                                        // error
  1.4061 +                                    {
  1.4062 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4063 +                                        is.setstate(::std::ios::failbit);
  1.4064 +#else
  1.4065 +                                        is.setstate(::std::ios_base::failbit);
  1.4066 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4067 +                                    }
  1.4068 +                                }
  1.4069 +                                else                                        // read "(a,b,c" or "(a,c,e"
  1.4070 +                                {
  1.4071 +                                    is.putback(ch);
  1.4072 +                                    
  1.4073 +                                    is >> c;
  1.4074 +                                    
  1.4075 +                                    if    (!is.good())    goto finish;
  1.4076 +                                    
  1.4077 +                                    is >> ch;                                    // get the next lexeme
  1.4078 +                                                                
  1.4079 +                                    if    (!is.good())    goto finish;
  1.4080 +                                    
  1.4081 +#ifdef    BOOST_NO_STD_LOCALE
  1.4082 +                                    cc = ch;
  1.4083 +#else
  1.4084 +                                    cc = ct.narrow(ch, char());
  1.4085 +#endif /* BOOST_NO_STD_LOCALE */
  1.4086 +                                    
  1.4087 +                                    if        (cc == ')')                            // read "(a,b,c)" (ambiguity resolution)
  1.4088 +                                    {
  1.4089 +                                        o = octonion<T>(a,b,c);
  1.4090 +                                    }
  1.4091 +                                    else if    (cc == ',')                            // read "(a,b,c," or "(a,c,e,"
  1.4092 +                                    {
  1.4093 +                                        is >> ch;                                    // get the next lexeme
  1.4094 +                                                                    
  1.4095 +                                        if    (!is.good())    goto finish;
  1.4096 +                                        
  1.4097 +#ifdef    BOOST_NO_STD_LOCALE
  1.4098 +                                        cc = ch;
  1.4099 +#else
  1.4100 +                                        cc = ct.narrow(ch, char());
  1.4101 +#endif /* BOOST_NO_STD_LOCALE */
  1.4102 +                                        
  1.4103 +                                        if        (cc == '(')                            // read "(a,c,e,(") (ambiguity resolution)
  1.4104 +                                        {
  1.4105 +                                            u = ::std::complex<T>(a);
  1.4106 +                                            
  1.4107 +                                            v = ::std::complex<T>(b);                    // "b" is actually "c"
  1.4108 +                                            
  1.4109 +                                            x = ::std::complex<T>(c);                    // "c" is actually "e"
  1.4110 +                                            
  1.4111 +                                            is.putback(ch);                                // we backtrack
  1.4112 +                                            
  1.4113 +                                            is >> y;                                    // read "(a,c,e,y"
  1.4114 +                                            
  1.4115 +                                            if    (!is.good())    goto finish;
  1.4116 +                                            
  1.4117 +                                            is >> ch;                                    // get the next lexeme
  1.4118 +                                                                        
  1.4119 +                                            if    (!is.good())    goto finish;
  1.4120 +                                            
  1.4121 +#ifdef    BOOST_NO_STD_LOCALE
  1.4122 +                                            cc = ch;
  1.4123 +#else
  1.4124 +                                            cc = ct.narrow(ch, char());
  1.4125 +#endif /* BOOST_NO_STD_LOCALE */
  1.4126 +                                            
  1.4127 +                                            if        (cc == ')')                            // read "(a,c,e,y)"
  1.4128 +                                            {
  1.4129 +                                                o = octonion<T>(u,v,x,y);
  1.4130 +                                            }
  1.4131 +                                            else                                        // error
  1.4132 +                                            {
  1.4133 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4134 +                                                is.setstate(::std::ios::failbit);
  1.4135 +#else
  1.4136 +                                                is.setstate(::std::ios_base::failbit);
  1.4137 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4138 +                                            }
  1.4139 +                                        }
  1.4140 +                                        else                                        // read "(a,b,c,d" (ambiguity resolution)
  1.4141 +                                        {
  1.4142 +                                            is.putback(ch);                                // we backtrack
  1.4143 +                                            
  1.4144 +                                            is >> d;
  1.4145 +                                            
  1.4146 +                                            if    (!is.good())    goto finish;
  1.4147 +                                            
  1.4148 +                                            is >> ch;                                    // get the next lexeme
  1.4149 +                                                                        
  1.4150 +                                            if    (!is.good())    goto finish;
  1.4151 +                                            
  1.4152 +#ifdef    BOOST_NO_STD_LOCALE
  1.4153 +                                            cc = ch;
  1.4154 +#else
  1.4155 +                                            cc = ct.narrow(ch, char());
  1.4156 +#endif /* BOOST_NO_STD_LOCALE */
  1.4157 +                                            
  1.4158 +                                            if        (cc == ')')                            // read "(a,b,c,d)"
  1.4159 +                                            {
  1.4160 +                                                o = octonion<T>(a,b,c,d);
  1.4161 +                                            }
  1.4162 +                                            else if    (cc == ',')                            // read "(a,b,c,d,"
  1.4163 +                                            {
  1.4164 +                                                is >> e;                                    // read "(a,b,c,d,e"
  1.4165 +                                                
  1.4166 +                                                if    (!is.good())    goto finish;
  1.4167 +                                                
  1.4168 +                                                is >> ch;                                    // get the next lexeme
  1.4169 +                                                                            
  1.4170 +                                                if    (!is.good())    goto finish;
  1.4171 +                                                
  1.4172 +#ifdef    BOOST_NO_STD_LOCALE
  1.4173 +                                                cc = ch;
  1.4174 +#else
  1.4175 +                                                cc = ct.narrow(ch, char());
  1.4176 +#endif /* BOOST_NO_STD_LOCALE */
  1.4177 +                                                
  1.4178 +                                                if        (cc == ')')                            // read "(a,b,c,d,e)"
  1.4179 +                                                {
  1.4180 +                                                    o = octonion<T>(a,b,c,d,e);
  1.4181 +                                                }
  1.4182 +                                                else if    (cc == ',')                            // read "(a,b,c,d,e,"
  1.4183 +                                                {
  1.4184 +                                                    is >> f;                                    // read "(a,b,c,d,e,f"
  1.4185 +                                                    
  1.4186 +                                                    if    (!is.good())    goto finish;
  1.4187 +                                                    
  1.4188 +                                                    is >> ch;                                    // get the next lexeme
  1.4189 +                                                                                
  1.4190 +                                                    if    (!is.good())    goto finish;
  1.4191 +                                                    
  1.4192 +#ifdef    BOOST_NO_STD_LOCALE
  1.4193 +                                                    cc = ch;
  1.4194 +#else
  1.4195 +                                                    cc = ct.narrow(ch, char());
  1.4196 +#endif /* BOOST_NO_STD_LOCALE */
  1.4197 +                                                    
  1.4198 +                                                    if        (cc == ')')                            // read "(a,b,c,d,e,f)"
  1.4199 +                                                    {
  1.4200 +                                                        o = octonion<T>(a,b,c,d,e,f);
  1.4201 +                                                    }
  1.4202 +                                                    else if    (cc == ',')                            // read "(a,b,c,d,e,f,"
  1.4203 +                                                    {
  1.4204 +                                                        is >> g;                                    // read "(a,b,c,d,e,f,g"                                    // read "(a,b,c,d,e,f"
  1.4205 +                                                        
  1.4206 +                                                        if    (!is.good())    goto finish;
  1.4207 +                                                        
  1.4208 +                                                        is >> ch;                                    // get the next lexeme
  1.4209 +                                                                                    
  1.4210 +                                                        if    (!is.good())    goto finish;
  1.4211 +                                                        
  1.4212 +#ifdef    BOOST_NO_STD_LOCALE
  1.4213 +                                                        cc = ch;
  1.4214 +#else
  1.4215 +                                                        cc = ct.narrow(ch, char());
  1.4216 +#endif /* BOOST_NO_STD_LOCALE */
  1.4217 +                                                        
  1.4218 +                                                        if        (cc == ')')                            // read "(a,b,c,d,e,f,g)"
  1.4219 +                                                        {
  1.4220 +                                                            o = octonion<T>(a,b,c,d,e,f,g);
  1.4221 +                                                        }
  1.4222 +                                                        else if    (cc == ',')                            // read "(a,b,c,d,e,f,g,"
  1.4223 +                                                        {
  1.4224 +                                                            is >> h;                                    // read "(a,b,c,d,e,f,g,h"                                    // read "(a,b,c,d,e,f,g"                                    // read "(a,b,c,d,e,f"
  1.4225 +                                                            
  1.4226 +                                                            if    (!is.good())    goto finish;
  1.4227 +                                                            
  1.4228 +                                                            is >> ch;                                    // get the next lexeme
  1.4229 +                                                                                        
  1.4230 +                                                            if    (!is.good())    goto finish;
  1.4231 +                                                            
  1.4232 +#ifdef    BOOST_NO_STD_LOCALE
  1.4233 +                                                            cc = ch;
  1.4234 +#else
  1.4235 +                                                            cc = ct.narrow(ch, char());
  1.4236 +#endif /* BOOST_NO_STD_LOCALE */
  1.4237 +                                                            
  1.4238 +                                                            if        (cc == ')')                            // read "(a,b,c,d,e,f,g,h)"
  1.4239 +                                                            {
  1.4240 +                                                                o = octonion<T>(a,b,c,d,e,f,g,h);
  1.4241 +                                                            }
  1.4242 +                                                            else                                        // error
  1.4243 +                                                            {
  1.4244 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4245 +                                                                is.setstate(::std::ios::failbit);
  1.4246 +#else
  1.4247 +                                                                is.setstate(::std::ios_base::failbit);
  1.4248 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4249 +                                                            }
  1.4250 +                                                        }
  1.4251 +                                                        else                                        // error
  1.4252 +                                                        {
  1.4253 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4254 +                                                            is.setstate(::std::ios::failbit);
  1.4255 +#else
  1.4256 +                                                            is.setstate(::std::ios_base::failbit);
  1.4257 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4258 +                                                        }
  1.4259 +                                                    }
  1.4260 +                                                    else                                        // error
  1.4261 +                                                    {
  1.4262 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4263 +                                                        is.setstate(::std::ios::failbit);
  1.4264 +#else
  1.4265 +                                                        is.setstate(::std::ios_base::failbit);
  1.4266 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4267 +                                                    }
  1.4268 +                                                }
  1.4269 +                                                else                                        // error
  1.4270 +                                                {
  1.4271 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4272 +                                                    is.setstate(::std::ios::failbit);
  1.4273 +#else
  1.4274 +                                                    is.setstate(::std::ios_base::failbit);
  1.4275 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4276 +                                                }
  1.4277 +                                            }
  1.4278 +                                            else                                        // error
  1.4279 +                                            {
  1.4280 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4281 +                                                is.setstate(::std::ios::failbit);
  1.4282 +#else
  1.4283 +                                                is.setstate(::std::ios_base::failbit);
  1.4284 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4285 +                                            }
  1.4286 +                                        }
  1.4287 +                                    }
  1.4288 +                                    else                                        // error
  1.4289 +                                    {
  1.4290 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4291 +                                        is.setstate(::std::ios::failbit);
  1.4292 +#else
  1.4293 +                                        is.setstate(::std::ios_base::failbit);
  1.4294 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4295 +                                    }
  1.4296 +                                }
  1.4297 +                            }
  1.4298 +                            else                                        // error
  1.4299 +                            {
  1.4300 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4301 +                                is.setstate(::std::ios::failbit);
  1.4302 +#else
  1.4303 +                                is.setstate(::std::ios_base::failbit);
  1.4304 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4305 +                            }
  1.4306 +                        }
  1.4307 +                    }
  1.4308 +                    else                                        // error
  1.4309 +                    {
  1.4310 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4311 +                        is.setstate(::std::ios::failbit);
  1.4312 +#else
  1.4313 +                        is.setstate(::std::ios_base::failbit);
  1.4314 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4315 +                    }
  1.4316 +                }
  1.4317 +            }
  1.4318 +            else                                        // format:    a
  1.4319 +            {
  1.4320 +                is.putback(ch);
  1.4321 +                
  1.4322 +                is >> a;                                    // we extract the first component
  1.4323 +                
  1.4324 +                if    (!is.good())    goto finish;
  1.4325 +                
  1.4326 +                o = octonion<T>(a);
  1.4327 +            }
  1.4328 +            
  1.4329 +            finish:
  1.4330 +            return(is);
  1.4331 +        }
  1.4332 +        
  1.4333 +        
  1.4334 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4335 +        template<typename T>
  1.4336 +        ::std::ostream &                        operator << (    ::std::ostream & os,
  1.4337 +                                                                octonion<T> const & o)
  1.4338 +#else
  1.4339 +        template<typename T, typename charT, class traits>
  1.4340 +        ::std::basic_ostream<charT,traits> &    operator << (    ::std::basic_ostream<charT,traits> & os,
  1.4341 +                                                                octonion<T> const & o)
  1.4342 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4343 +        {
  1.4344 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4345 +            ::std::ostringstream                        s;
  1.4346 +#else
  1.4347 +            ::std::basic_ostringstream<charT,traits>    s;
  1.4348 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4349 +            
  1.4350 +            s.flags(os.flags());
  1.4351 +#ifdef    BOOST_NO_STD_LOCALE
  1.4352 +#else
  1.4353 +            s.imbue(os.getloc());
  1.4354 +#endif /* BOOST_NO_STD_LOCALE */
  1.4355 +            s.precision(os.precision());
  1.4356 +            
  1.4357 +            s << '('    << o.R_component_1() << ','
  1.4358 +                        << o.R_component_2() << ','
  1.4359 +                        << o.R_component_3() << ','
  1.4360 +                        << o.R_component_4() << ','
  1.4361 +                        << o.R_component_5() << ','
  1.4362 +                        << o.R_component_6() << ','
  1.4363 +                        << o.R_component_7() << ','
  1.4364 +                        << o.R_component_8() << ')';
  1.4365 +            
  1.4366 +            return os << s.str();
  1.4367 +        }
  1.4368 +        
  1.4369 +        
  1.4370 +        // values
  1.4371 +        
  1.4372 +        template<typename T>
  1.4373 +        inline T                                real(octonion<T> const & o)
  1.4374 +        {
  1.4375 +            return(o.real());
  1.4376 +        }
  1.4377 +        
  1.4378 +        
  1.4379 +        template<typename T>
  1.4380 +        inline octonion<T>                        unreal(octonion<T> const & o)
  1.4381 +        {
  1.4382 +            return(o.unreal());
  1.4383 +        }
  1.4384 +        
  1.4385 +        
  1.4386 +#define    BOOST_OCTONION_VALARRAY_LOADER   \
  1.4387 +            using    ::std::valarray;       \
  1.4388 +                                            \
  1.4389 +            valarray<T>    temp(8);         \
  1.4390 +                                            \
  1.4391 +            temp[0] = o.R_component_1();    \
  1.4392 +            temp[1] = o.R_component_2();    \
  1.4393 +            temp[2] = o.R_component_3();    \
  1.4394 +            temp[3] = o.R_component_4();    \
  1.4395 +            temp[4] = o.R_component_5();    \
  1.4396 +            temp[5] = o.R_component_6();    \
  1.4397 +            temp[6] = o.R_component_7();    \
  1.4398 +            temp[7] = o.R_component_8();
  1.4399 +        
  1.4400 +        
  1.4401 +        template<typename T>
  1.4402 +        inline T                                sup(octonion<T> const & o)
  1.4403 +        {
  1.4404 +#ifdef    BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  1.4405 +            using    ::std::abs;
  1.4406 +#endif    /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */
  1.4407 +            
  1.4408 +            BOOST_OCTONION_VALARRAY_LOADER
  1.4409 +            
  1.4410 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4411 +            return((BOOST_GET_VALARRAY(T, abs(temp)).max)());
  1.4412 +#else
  1.4413 +            return((abs(temp).max)());
  1.4414 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4415 +        }
  1.4416 +        
  1.4417 +        
  1.4418 +        template<typename T>
  1.4419 +        inline T                                l1(octonion<T> const & o)
  1.4420 +        {
  1.4421 +#ifdef    BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  1.4422 +            using    ::std::abs;
  1.4423 +#endif    /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */
  1.4424 +            
  1.4425 +            BOOST_OCTONION_VALARRAY_LOADER
  1.4426 +            
  1.4427 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4428 +            return(BOOST_GET_VALARRAY(T, abs(temp)).sum());
  1.4429 +#else
  1.4430 +            return(abs(temp).sum());
  1.4431 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4432 +        }
  1.4433 +        
  1.4434 +        
  1.4435 +        template<typename T>
  1.4436 +        inline T                                abs(const octonion<T> & o)
  1.4437 +        {
  1.4438 +#ifdef    BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  1.4439 +            using    ::std::abs;
  1.4440 +#endif    /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */
  1.4441 +            
  1.4442 +            using    ::std::sqrt;
  1.4443 +            
  1.4444 +            BOOST_OCTONION_VALARRAY_LOADER
  1.4445 +            
  1.4446 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4447 +            T            maxim = (BOOST_GET_VALARRAY(T,abs(temp)).max)();    // overflow protection
  1.4448 +#else
  1.4449 +            T            maxim = (abs(temp).max)();    // overflow protection
  1.4450 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4451 +            
  1.4452 +            if    (maxim == static_cast<T>(0))
  1.4453 +            {
  1.4454 +                return(maxim);
  1.4455 +            }
  1.4456 +            else
  1.4457 +            {
  1.4458 +                T    mixam = static_cast<T>(1)/maxim;    // prefer multiplications over divisions
  1.4459 +                
  1.4460 +                temp *= mixam;
  1.4461 +                
  1.4462 +                temp *= temp;
  1.4463 +                
  1.4464 +                return(maxim*sqrt(temp.sum()));
  1.4465 +            }
  1.4466 +            
  1.4467 +            //return(::std::sqrt(norm(o)));
  1.4468 +        }
  1.4469 +        
  1.4470 +        
  1.4471 +#undef    BOOST_OCTONION_VALARRAY_LOADER
  1.4472 +        
  1.4473 +        
  1.4474 +        // Note:    This is the Cayley norm, not the Euclidian norm...
  1.4475 +        
  1.4476 +        template<typename T>
  1.4477 +        inline T                                norm(octonion<T> const & o)
  1.4478 +        {
  1.4479 +            return(real(o*conj(o)));
  1.4480 +        }
  1.4481 +        
  1.4482 +        
  1.4483 +        template<typename T>
  1.4484 +        inline octonion<T>                        conj(octonion<T> const & o)
  1.4485 +        {
  1.4486 +            return(octonion<T>( +o.R_component_1(),
  1.4487 +                                -o.R_component_2(),
  1.4488 +                                -o.R_component_3(),
  1.4489 +                                -o.R_component_4(),
  1.4490 +                                -o.R_component_5(),
  1.4491 +                                -o.R_component_6(),
  1.4492 +                                -o.R_component_7(),
  1.4493 +                                -o.R_component_8()));
  1.4494 +        }
  1.4495 +        
  1.4496 +        
  1.4497 +        // Note:    There is little point, for the octonions, to introduce the equivalents
  1.4498 +        //            to the complex "arg" and the quaternionic "cylindropolar".
  1.4499 +        
  1.4500 +        
  1.4501 +        template<typename T>
  1.4502 +        inline octonion<T>                        spherical(T const & rho,
  1.4503 +                                                            T const & theta,
  1.4504 +                                                            T const & phi1,
  1.4505 +                                                            T const & phi2,
  1.4506 +                                                            T const & phi3,
  1.4507 +                                                            T const & phi4,
  1.4508 +                                                            T const & phi5,
  1.4509 +                                                            T const & phi6)
  1.4510 +        {
  1.4511 +            using ::std::cos;
  1.4512 +            using ::std::sin;
  1.4513 +            
  1.4514 +            //T    a = cos(theta)*cos(phi1)*cos(phi2)*cos(phi3)*cos(phi4)*cos(phi5)*cos(phi6);
  1.4515 +            //T    b = sin(theta)*cos(phi1)*cos(phi2)*cos(phi3)*cos(phi4)*cos(phi5)*cos(phi6);
  1.4516 +            //T    c = sin(phi1)*cos(phi2)*cos(phi3)*cos(phi4)*cos(phi5)*cos(phi6);
  1.4517 +            //T    d = sin(phi2)*cos(phi3)*cos(phi4)*cos(phi5)*cos(phi6);
  1.4518 +            //T    e = sin(phi3)*cos(phi4)*cos(phi5)*cos(phi6);
  1.4519 +            //T    f = sin(phi4)*cos(phi5)*cos(phi6);
  1.4520 +            //T    g = sin(phi5)*cos(phi6);
  1.4521 +            //T    h = sin(phi6);
  1.4522 +            
  1.4523 +            T    courrant = static_cast<T>(1);
  1.4524 +            
  1.4525 +            T    h = sin(phi6);
  1.4526 +            
  1.4527 +            courrant *= cos(phi6);
  1.4528 +            
  1.4529 +            T    g = sin(phi5)*courrant;
  1.4530 +            
  1.4531 +            courrant *= cos(phi5);
  1.4532 +            
  1.4533 +            T    f = sin(phi4)*courrant;
  1.4534 +            
  1.4535 +            courrant *= cos(phi4);
  1.4536 +            
  1.4537 +            T    e = sin(phi3)*courrant;
  1.4538 +            
  1.4539 +            courrant *= cos(phi3);
  1.4540 +            
  1.4541 +            T    d = sin(phi2)*courrant;
  1.4542 +            
  1.4543 +            courrant *= cos(phi2);
  1.4544 +            
  1.4545 +            T    c = sin(phi1)*courrant;
  1.4546 +            
  1.4547 +            courrant *= cos(phi1);
  1.4548 +            
  1.4549 +            T    b = sin(theta)*courrant;
  1.4550 +            T    a = cos(theta)*courrant;
  1.4551 +            
  1.4552 +            return(rho*octonion<T>(a,b,c,d,e,f,g,h));
  1.4553 +        }
  1.4554 +        
  1.4555 +        
  1.4556 +        template<typename T>
  1.4557 +        inline octonion<T>                        multipolar(T const & rho1,
  1.4558 +                                                             T const & theta1,
  1.4559 +                                                             T const & rho2,
  1.4560 +                                                             T const & theta2,
  1.4561 +                                                             T const & rho3,
  1.4562 +                                                             T const & theta3,
  1.4563 +                                                             T const & rho4,
  1.4564 +                                                             T const & theta4)
  1.4565 +        {
  1.4566 +            using ::std::cos;
  1.4567 +            using ::std::sin;
  1.4568 +            
  1.4569 +            T    a = rho1*cos(theta1);
  1.4570 +            T    b = rho1*sin(theta1);
  1.4571 +            T    c = rho2*cos(theta2);
  1.4572 +            T    d = rho2*sin(theta2);
  1.4573 +            T    e = rho3*cos(theta3);
  1.4574 +            T    f = rho3*sin(theta3);
  1.4575 +            T    g = rho4*cos(theta4);
  1.4576 +            T    h = rho4*sin(theta4);
  1.4577 +            
  1.4578 +            return(octonion<T>(a,b,c,d,e,f,g,h));
  1.4579 +        }
  1.4580 +        
  1.4581 +        
  1.4582 +        template<typename T>
  1.4583 +        inline octonion<T>                        cylindrical(T const & r,
  1.4584 +                                                              T const & angle,
  1.4585 +                                                              T const & h1,
  1.4586 +                                                              T const & h2,
  1.4587 +                                                              T const & h3,
  1.4588 +                                                              T const & h4,
  1.4589 +                                                              T const & h5,
  1.4590 +                                                              T const & h6)
  1.4591 +        {
  1.4592 +            using ::std::cos;
  1.4593 +            using ::std::sin;
  1.4594 +            
  1.4595 +            T    a = r*cos(angle);
  1.4596 +            T    b = r*sin(angle);
  1.4597 +            
  1.4598 +            return(octonion<T>(a,b,h1,h2,h3,h4,h5,h6));
  1.4599 +        }
  1.4600 +        
  1.4601 +        
  1.4602 +        template<typename T>
  1.4603 +        inline octonion<T>                        exp(octonion<T> const & o)
  1.4604 +        {
  1.4605 +            using    ::std::exp;
  1.4606 +            using    ::std::cos;
  1.4607 +            
  1.4608 +            using    ::boost::math::sinc_pi;
  1.4609 +            
  1.4610 +            T    u = exp(real(o));
  1.4611 +            
  1.4612 +            T    z = abs(unreal(o));
  1.4613 +            
  1.4614 +            T    w = sinc_pi(z);
  1.4615 +            
  1.4616 +            return(u*octonion<T>(cos(z),
  1.4617 +                w*o.R_component_2(), w*o.R_component_3(),
  1.4618 +                w*o.R_component_4(), w*o.R_component_5(),
  1.4619 +                w*o.R_component_6(), w*o.R_component_7(),
  1.4620 +                w*o.R_component_8()));
  1.4621 +        }
  1.4622 +        
  1.4623 +        
  1.4624 +        template<typename T>
  1.4625 +        inline octonion<T>                        cos(octonion<T> const & o)
  1.4626 +        {
  1.4627 +            using    ::std::sin;
  1.4628 +            using    ::std::cos;
  1.4629 +            using    ::std::cosh;
  1.4630 +            
  1.4631 +            using    ::boost::math::sinhc_pi;
  1.4632 +            
  1.4633 +            T    z = abs(unreal(o));
  1.4634 +            
  1.4635 +            T    w = -sin(o.real())*sinhc_pi(z);
  1.4636 +            
  1.4637 +            return(octonion<T>(cos(o.real())*cosh(z),
  1.4638 +                w*o.R_component_2(), w*o.R_component_3(),
  1.4639 +                w*o.R_component_4(), w*o.R_component_5(),
  1.4640 +                w*o.R_component_6(), w*o.R_component_7(),
  1.4641 +                w*o.R_component_8()));
  1.4642 +        }
  1.4643 +        
  1.4644 +        
  1.4645 +        template<typename T>
  1.4646 +        inline octonion<T>                        sin(octonion<T> const & o)
  1.4647 +        {
  1.4648 +            using    ::std::sin;
  1.4649 +            using    ::std::cos;
  1.4650 +            using    ::std::cosh;
  1.4651 +            
  1.4652 +            using    ::boost::math::sinhc_pi;
  1.4653 +            
  1.4654 +            T    z = abs(unreal(o));
  1.4655 +            
  1.4656 +            T    w = +cos(o.real())*sinhc_pi(z);
  1.4657 +            
  1.4658 +            return(octonion<T>(sin(o.real())*cosh(z),
  1.4659 +                w*o.R_component_2(), w*o.R_component_3(),
  1.4660 +                w*o.R_component_4(), w*o.R_component_5(),
  1.4661 +                w*o.R_component_6(), w*o.R_component_7(),
  1.4662 +                w*o.R_component_8()));
  1.4663 +        }
  1.4664 +        
  1.4665 +        
  1.4666 +        template<typename T>
  1.4667 +        inline octonion<T>                        tan(octonion<T> const & o)
  1.4668 +        {
  1.4669 +            return(sin(o)/cos(o));
  1.4670 +        }
  1.4671 +        
  1.4672 +        
  1.4673 +        template<typename T>
  1.4674 +        inline octonion<T>                        cosh(octonion<T> const & o)
  1.4675 +        {
  1.4676 +            return((exp(+o)+exp(-o))/static_cast<T>(2));
  1.4677 +        }
  1.4678 +        
  1.4679 +        
  1.4680 +        template<typename T>
  1.4681 +        inline octonion<T>                        sinh(octonion<T> const & o)
  1.4682 +        {
  1.4683 +            return((exp(+o)-exp(-o))/static_cast<T>(2));
  1.4684 +        }
  1.4685 +        
  1.4686 +        
  1.4687 +        template<typename T>
  1.4688 +        inline octonion<T>                        tanh(octonion<T> const & o)
  1.4689 +        {
  1.4690 +            return(sinh(o)/cosh(o));
  1.4691 +        }
  1.4692 +        
  1.4693 +        
  1.4694 +        template<typename T>
  1.4695 +        octonion<T>                                pow(octonion<T> const & o,
  1.4696 +                                                    int n)
  1.4697 +        {
  1.4698 +            if        (n > 1)
  1.4699 +            {
  1.4700 +                int    m = n>>1;
  1.4701 +                
  1.4702 +                octonion<T>    result = pow(o, m);
  1.4703 +                
  1.4704 +                result *= result;
  1.4705 +                
  1.4706 +                if    (n != (m<<1))
  1.4707 +                {
  1.4708 +                    result *= o; // n odd
  1.4709 +                }
  1.4710 +                
  1.4711 +                return(result);
  1.4712 +            }
  1.4713 +            else if    (n == 1)
  1.4714 +            {
  1.4715 +                return(o);
  1.4716 +            }
  1.4717 +            else if    (n == 0)
  1.4718 +            {
  1.4719 +                return(octonion<T>(1));
  1.4720 +            }
  1.4721 +            else    /* n < 0 */
  1.4722 +            {
  1.4723 +                return(pow(octonion<T>(1)/o,-n));
  1.4724 +            }
  1.4725 +        }
  1.4726 +        
  1.4727 +        
  1.4728 +        // helper templates for converting copy constructors (definition)
  1.4729 +        
  1.4730 +        namespace detail
  1.4731 +        {
  1.4732 +            
  1.4733 +            template<   typename T,
  1.4734 +                        typename U
  1.4735 +                    >
  1.4736 +            octonion<T>    octonion_type_converter(octonion<U> const & rhs)
  1.4737 +            {
  1.4738 +                return(octonion<T>( static_cast<T>(rhs.R_component_1()),
  1.4739 +                                    static_cast<T>(rhs.R_component_2()),
  1.4740 +                                    static_cast<T>(rhs.R_component_3()),
  1.4741 +                                    static_cast<T>(rhs.R_component_4()),
  1.4742 +                                    static_cast<T>(rhs.R_component_5()),
  1.4743 +                                    static_cast<T>(rhs.R_component_6()),
  1.4744 +                                    static_cast<T>(rhs.R_component_7()),
  1.4745 +                                    static_cast<T>(rhs.R_component_8())));
  1.4746 +            }
  1.4747 +        }
  1.4748 +    }
  1.4749 +}
  1.4750 +
  1.4751 +
  1.4752 +#if    BOOST_WORKAROUND(__GNUC__, < 3)
  1.4753 +    #undef    BOOST_GET_VALARRAY
  1.4754 +#endif /* BOOST_WORKAROUND(__GNUC__, < 3) */
  1.4755 +
  1.4756 +
  1.4757 +#endif /* BOOST_OCTONION_HPP */