Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2007-12-12 05:38:54


From: Jeremy Bruestle
> As far as testing, I've only done the basics, but things seem
> alright, with the possible concern that the range is
> 0 <= x <= 1 as opposed to 0 < x < 1, due to limited precision
> of floating point, esp when for example a is near 0 and b is
> very large. It's not a problem for my application, but perhaps
> someone who knows the IEEE floating point rules better than I could
> suggest a fix.

Well I don't know much about IEEE, but there's the brute force approach
        double result;
        do
        {
                result = clever_stuff();
        }
        while (result != 0.0 && result != 1.0);
        return result;

(Of course, that doesn't look so good when the parameters are such that
result tends to be 0.0 a very large percentage of the time.)

-- 
Martin Bonner
Senior Software Engineer/Team Leader
PI SHURLOK LTD
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]
www.pi-shurlok.com
disclaimer

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