Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-07-30 05:13:50


"David Abrahams" <dave_at_[hidden]> wrote in message
news:uvepgcdv8.fsf_at_boost-consulting.com...
> cybernet_at_[hidden] writes:
>
>> In:
>> /usr/include/boost/test/floating_point_comparison.hpp
>>
>> inside:
>>
>> template<typename FPT> inline FPT safe_fpt_division( FPT f1, FPT
>> f2 ){
>>
>> the warning is cause by the code:
>>
>> // Avoid underflow.
>> if( f1 == static_cast<FPT>(0) ||
>> f2 > static_cast<FPT>(1) && f1 < f2 *
>> (std::numeric_limits<FPT>::min)() )
>> return static_cast<FPT>(0);
>>
>> Could someone modify the code to allow it to compile without warnings on
>> g++?
>
> Try replacing
>
> f1 == static_cast<FPT>(0)
>
> with
>
> f1

I am not sure that it will be 100% equivalent for all FP types including
user defined.

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net