|
Boost : |
Subject: Re: [boost] floating point FUD
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-01-23 12:24:08
Thomas Klimpel wrote:
> Hi,
>
> Find attached a small test program that tries to highlight some of the
> "usual" floating point traps. The essence is the following small function
> that outputs the results of some "buggy" floating point logic. The rest is
> just setting up the environment so that the bugs actually get triggered.
>
Hello Thomas,
I'm unable to reproduce, see below. Looking at your code, you might want to
give std::fabs() a try over abs(). I remember having been bitten hard by
that one-letter difference.
Cheers,
Rutger
$ g++ test_fp.cpp -DNDEBUG -O2 -msse2 -Wall
$ ./a.out
t_tt = 0
abs_t = 1
a_c = 1
b_d = 1
equal = [ 1 1 1 ]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk