Boost logo

Boost :

Subject: Re: [boost] [lexical_cast][math] can't unconditionally call math::changesign with long double
From: John Maddock (boost.regex_at_[hidden])
Date: 2013-02-24 04:16:01


>>> lexical_cast is using math::changesign with long double regardless of
>>> whether BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is defined or not. This
>>> is causing Boost.Test build problems (see here
>>> http://tinyurl.com/af5453h
>>> ).
>>>
>>> I'm pretty sure this is a bug in lexical_cast, so I've opened a ticket:
>>> https://svn.boost.org/trac/boost/ticket/8162
>
> So, portable way of changing sign is just to multiply on -1 ?

Doesn't work for NaN's if you care about that (probably not in this case?)

> And math::isnan I shall change to value != value ?

That doesn't always work, actually it quite often doesn't work, especially
in release mode.

> And math::isinf to something like value >= numeric_limits<>::max?

Make that fabs(value) > numeric_limits<>::max and it should work - unless of
course the system has no (reliable) long double math functions in which case
fabs(double) may be called rather than a true fabs(long double), and you may
get spurious overflow (finite long double treated as non-finite double).

Fun isn't it? :-(

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk