Boost logo

Boost :

From: Michael Kettner (kettner_at_[hidden])
Date: 2004-07-27 11:58:47


Hi,

I want to use the boost::test floating-point comparison algorithms (Boost
1.31.0) and wrote the following simple lines of code:

double d1 = 0.2;
double d2 = 0.8;
double d3 = d2-d1-d1-d1-d1; // d3 should be zero
        
bool b = boost::test_toolbox::check_is_closed( d3, 0., 1e-3 );

To my surprise, the return value b is FALSE, although d3 should be _very_
close to zero (and is 5.55112e-17 on my machine).

Am I missing something or is this a bug in the test library?

Thanks,
 Michael

-- 
Michael Kettner
kettner_at_[hidden]

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