The sum that does not equals the sum. gdb involved.
Hello everyone,
I'm having a very strange problem with my code. In an assignment, the right hand is a sum, that I verify using gdb. The left side does not take that value. Instead, it takes the rounded value. Given that the values are doubles, I wasn't expecting a round up.
The following code is what I run with gdb:
Code:
54 for (Int i = 0; i < nvar; i++)
(gdb)
55 xx[i] = xcx[i] + dx[i];
(gdb)
54 for (Int i = 0; i < nvar; i++)
(gdb) print xcx[0]
$1 = 0.49999999998343619
(gdb) print dx[0]
$2 = 1.6563789318635447e-11
(gdb) print i
$3 = 0
(gdb) print xcx[0]+dx[0]
$4 = 0.49999999999999994
(gdb) print xx[0]
$5 = 0.5
Unfortunately the project is too big and has too many dependencies.
Thanks in advance.