I just recently encountered this problem in c++
std::cout << -5.0000004768371582 + 5 << "\n";
This will print -4.76837e-007 even though you would think it would print something like 0.000000476... I know floating points aren't always correct, but I've never seen this before. I've also seen this happen with other numbers.
Why is this. And how could I fix it?