
23 Jan
2010
23 Jan
'10
5:24 p.m.
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 ]