Modify

Ticket #8162 (closed Bugs: fixed)

Opened 14 months ago

Last modified 13 months ago

lexical_cast is using math::changesign with long double regardless of whether BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is defined or not.

Reported by: eric_niebler Owned by: apolukhin
Milestone: Boost 1.54.0 Component: lexical_cast
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Line 1399-1400 of boost::lexical_cast looks like this:

long double result = std::pow(10.0L, pow_of_10) * mantissa;
value = static_cast<T>( has_minus ? (boost::math::changesign)(result) : result);

It turns out that this causes problems in the guts of Boost.Math when BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is defined. This is causing Boost.Test build failures. See for instance  http://tinyurl.com/af5453h, which at the time of writing shows:

    "g++"  -ftemplate-depth-128 -O0 -fno-inline -Wall -g -ftemplate-depth-1024 -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_NO_AUTO_LINK=1  -I".." -c -o "/usr/home/jim/boost_rt/trunk/results/boost/bin.v2/libs/xpressive/test/c_traits.test/gcc-4.2.1/debug/link-static/c_traits.o" "../libs/xpressive/test/c_traits.cpp"

In file included from ../libs/xpressive/test/./regress.ipp:19,
                 from ../libs/xpressive/test/c_traits.cpp:15:
../boost/math/tools/promotion.hpp: In instantiation of 'boost::math::tools::promote_args<long double, float, float, float, float, float>':
../boost/lexical_cast.hpp:1400:   instantiated from here
../boost/math/tools/promotion.hpp:141: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>' }}}

Aside: there is no entry for lexical_cast in libs/maintainers.txt. There should be.

Attachments

Change History

comment:1 Changed 14 months ago by apolukhin

(In [83113]) Add entry for lexical_cast library to maintainers.txt (refs #8162)

comment:2 Changed 14 months ago by apolukhin

(In [83129]) Do not use long double type in lexical_cast for internal variables if Boost.Math has no functions for long double (refs #8162) Do not test lexical_cast on long doubles, if Boost.Math does not support long double

comment:3 Changed 13 months ago by apolukhin

  • Status changed from new to closed
  • Resolution set to fixed

(In [83542]) Merge from trunk:

  • Fixed incorrect usage of Boost.Math when it does not support long double (fixes #8162)
  • Fixed ambiguity of boost::lexical_cast functions (fixes #7421)
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.