This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc 3.0.1 vs boost (regression)


After applying the appended patch to the boost repository, all tests pass
if gcc 3.0 is used as the c++ compiler. 
If gcc 3.0.1 is employed, there is a failure:
libs/math/quaternion/quaternion_test.cpp does not run successfully.

It seems that there is a lack of precision, if the long long type is
used. 

The patch is correct as confirmed by the maintainer of the
quaternion_test.cpp file, who states in private email that he has 
this patch in his private source tree, too and did not update the public
source tree because of the lack of time. 

I filed a report, libstdc++/3988, for this problem.


Hope this helps

Peter Schmid



g++ -o boosttmp.exe -Wall -W -I.. ../libs/math/quaternion/quaternion_test.cpp
../libs/math/quaternion/quaternion_test.cpp: In function `int test_main(int, 
   char**)':
../libs/math/quaternion/quaternion_test.cpp:38: warning: unused variable `
   boost::math::quaternion<float> qa[2]'
./boosttmp.exe 
Please input a quaternion...
You have entered the quaternion (1,2,3,4)
For this quaternion:
the value of the real part is 1
the value of the unreal part is (0,2,3,4)
the value of the sup norm is 4
the value of the l1 norm is 10
the value of the magnitude (euclidian norm) is 5.47723
the value of the (Cayley) norm is 30
the value of the conjugate is (1,-2,-3,-4)
the value of the exponential is (1.69392,-0.78956,-1.18434,-1.57912)
the value of the cube is (-86,-52,-78,-104)
the value of the cosinus is (58.9336,-34.0862,-51.1293,-68.1724)
the value of the sinus is (91.7837,21.8865,32.8297,43.773)
the value of the tangent is (3.82105e-05,0.371397,0.557096,0.742794)
the value of the hyperbolic cosinus is (0.961585,-0.341352,-0.512028,-0.682704)
the value of the hyperbolic sinus is (0.732338,-0.448207,-0.672311,-0.896415)
the value of the hyperbolic tangent is (1.02487,-0.102296,-0.153444,-0.204591)

The value of the quaternion represented in spherical form by rho = 2.82843 , theta = 0.785398 , phi1 = 0.785398 , phi2 = 0.785398 is (1,1,1.41421,2)
The value of the quaternion represented in semipolar form by rho = 2.82843 , alpha = 0.785398 , phi1 = 0.785398 , phi2 = 0.785398 is (1.41421,1.41421,1.41421,1.41421)
The value of the quaternion represented in multipolar form by rho1 = 1 , theta1 = 0 , rho2 = 2 , theta2 = 1.5708 is (1,0,-8.74228e-08,2)
The value of the quaternion represented in cylindrospherical form by t = 5 , radius = 1.41421 , longitude = 0.785398 , latitude = 1.0472 is (5,0.5,0.5,1.22474)
The value of the quaternion represented in cylindrical form by r = 1.41421 , angle = 0.785398 , h1 = 3 , h2 = 4 is (1,1,3,4)

Real 1: 1 ; Complex 1: (1,0) ; Quaternion 1: (1,0,0,0)
Complex i: (0,1) ; Quaternion i: (0,1,0,0)
Quaternion j: (0,0,1,0)
Quaternion k: (0,0,0,1)

i*i: (-1,0,0,0)
i*j: (0,0,0,1)
j*k: (0,1,0,0)
k*i: (0,0,1,0)


**** test failed: abs(static_cast<long double>(4)* cos(::boost::math::quaternion<long double>(0,::std::log(2.0),0,0))- static_cast<long double>(5)) <= 4*numeric_limits<long double>::epsilon(), file: ../libs/math/quaternion/quaternion_test.cpp, line: 545

**** test failed: abs(static_cast<long double>(4)* cos(::boost::math::quaternion<long double>(0,0,::std::log(2.0),0))- static_cast<long double>(5)) <= 4*numeric_limits<long double>::epsilon(), file: ../libs/math/quaternion/quaternion_test.cpp, line: 545

**** test failed: abs(static_cast<long double>(4)* cos(::boost::math::quaternion<long double>(0,0,0,::std::log(2.0)))- static_cast<long double>(5)) <= 4*numeric_limits<long double>::epsilon(), file: ../libs/math/quaternion/quaternion_test.cpp, line: 545

**** test failed: abs(static_cast<long double>(4)* sin(::boost::math::quaternion<long double>(0,::std::log(2.0),0,0))- ::boost::math::quaternion<long double>(0,3,0,0)) <= 4*numeric_limits<long double>::epsilon(), file: ../libs/math/quaternion/quaternion_test.cpp, line: 545

**** test failed: abs(static_cast<long double>(4)* sin(::boost::math::quaternion<long double>(0,0,::std::log(2.0),0))- ::boost::math::quaternion<long double>(0,0,3,0)) <= 4*numeric_limits<long double>::epsilon(), file: ../libs/math/quaternion/quaternion_test.cpp, line: 545

**** test failed: abs(static_cast<long double>(4)* sin(::boost::math::quaternion<long double>(0,0,0,::std::log(2.0)))- ::boost::math::quaternion<long double>(0,0,0,3)) <= 4*numeric_limits<long double>::epsilon(), file: ../libs/math/quaternion/quaternion_test.cpp, line: 545

**** 6 test errors detected

**** returning with error code 201
**********  errors detected; see stdout for details  ***********
Return code: 51456
Fail
 

 

*** libs/math/quaternion/quaternion_test.cpp.old	Sun Jul 22 02:54:05 2001
--- libs/math/quaternion/quaternion_test.cpp	Sun Jul 22 02:53:10 2001
*************** int    test_main(int, char *[])
*** 469,536 ****
      #define    BOOST_QUATERNION_TRENSCENDENTALS_TEST(type)                  \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             exp(::boost::math::quaternion<type>(0,4*::std::atan(1.0),0,0))+   \
              static_cast<type>(1)) <= 2*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             exp(::boost::math::quaternion<type>(0,0,4*::std::atan(1.0),0))+   \
              static_cast<type>(1)) <= 2*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             exp(::boost::math::quaternion<type>(0,0,0,4*::std::atan(1.0)))+   \
              static_cast<type>(1)) <= 2*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             cos(::boost::math::quaternion<type>(0,::std::log(2.0),0,0))-      \
              static_cast<type>(5)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             cos(::boost::math::quaternion<type>(0,0,::std::log(2.0),0))-      \
              static_cast<type>(5)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             cos(::boost::math::quaternion<type>(0,0,0,::std::log(2.0)))-      \
              static_cast<type>(5)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             sin(::boost::math::quaternion<type>(0,::std::log(2.0),0,0))-      \
              ::boost::math::quaternion<type>(0,3,0,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             sin(::boost::math::quaternion<type>(0,0,::std::log(2.0),0))-      \
              ::boost::math::quaternion<type>(0,0,3,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             sin(::boost::math::quaternion<type>(0,0,0,::std::log(2.0)))-      \
              ::boost::math::quaternion<type>(0,0,0,3)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             cosh(::boost::math::quaternion<type>(0,4*::std::atan(1.0),0,0))+  \
              static_cast<type>(1)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             cosh(::boost::math::quaternion<type>(0,0,4*::std::atan(1.0),0))+  \
              static_cast<type>(1)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             cosh(::boost::math::quaternion<type>(0,0,0,4*::std::atan(1.0)))+  \
              static_cast<type>(1)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             sinh(::boost::math::quaternion<type>(0,2*::std::atan(1.0),0,0))-  \
              ::boost::math::quaternion<type>(0,1,0,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             sinh(::boost::math::quaternion<type>(0,0,2*::std::atan(1.0),0))-  \
              ::boost::math::quaternion<type>(0,0,1,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             sinh(::boost::math::quaternion<type>(0,0,0,2*::std::atan(1.0)))-  \
              ::boost::math::quaternion<type>(0,0,0,1)) <=                    \
              4*numeric_limits<type>::epsilon());
      
--- 469,536 ----
      #define    BOOST_QUATERNION_TRENSCENDENTALS_TEST(type)                  \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             exp(::boost::math::quaternion<type>(0,4*::std::atan(static_cast<type>(1)),0,0))+   \
              static_cast<type>(1)) <= 2*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             exp(::boost::math::quaternion<type>(0,0,4*::std::atan(static_cast<type>(1)),0))+   \
              static_cast<type>(1)) <= 2*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             exp(::boost::math::quaternion<type>(0,0,0,4*::std::atan(static_cast<type>(1))))+   \
              static_cast<type>(1)) <= 2*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             cos(::boost::math::quaternion<type>(0,::std::log(static_cast<type>(2)),0,0))-      \
              static_cast<type>(5)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             cos(::boost::math::quaternion<type>(0,0,::std::log(static_cast<type>(2)),0))-      \
              static_cast<type>(5)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             cos(::boost::math::quaternion<type>(0,0,0,::std::log(static_cast<type>(2))))-      \
              static_cast<type>(5)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             sin(::boost::math::quaternion<type>(0,::std::log(static_cast<type>(2)),0,0))-      \
              ::boost::math::quaternion<type>(0,3,0,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             sin(::boost::math::quaternion<type>(0,0,::std::log(static_cast<type>(2)),0))-      \
              ::boost::math::quaternion<type>(0,0,3,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(static_cast<type>(4)*                                \
!             sin(::boost::math::quaternion<type>(0,0,0,::std::log(static_cast<type>(2))))-      \
              ::boost::math::quaternion<type>(0,0,0,3)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             cosh(::boost::math::quaternion<type>(0,4*::std::atan(static_cast<type>(1)),0,0))+  \
              static_cast<type>(1)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             cosh(::boost::math::quaternion<type>(0,0,4*::std::atan(static_cast<type>(1)),0))+  \
              static_cast<type>(1)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             cosh(::boost::math::quaternion<type>(0,0,0,4*::std::atan(static_cast<type>(1))))+  \
              static_cast<type>(1)) <= 4*numeric_limits<type>::epsilon());    \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             sinh(::boost::math::quaternion<type>(0,2*::std::atan(static_cast<type>(1)),0,0))-  \
              ::boost::math::quaternion<type>(0,1,0,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             sinh(::boost::math::quaternion<type>(0,0,2*::std::atan(static_cast<type>(1)),0))-  \
              ::boost::math::quaternion<type>(0,0,1,0)) <=                    \
              4*numeric_limits<type>::epsilon());                             \
                                                                              \
          BOOST_TEST(abs(                                                     \
!             sinh(::boost::math::quaternion<type>(0,0,0,2*::std::atan(static_cast<type>(1))))-  \
              ::boost::math::quaternion<type>(0,0,0,1)) <=                    \
              4*numeric_limits<type>::epsilon());
      


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]