I am trying to calculate something and want to check if the difference between two numbers is smaller than 10^-10. It didn’t work, so I used std::cout << (double)(10^-10) and it printed -4. Is this the correct behavior? How could I change it so that it actually results in 0.0000000001?
I am trying to calculate something and want to check if the difference between
Share
^is exclusive or in C. For constants you probably want to use scientific notation1e-10. For varying exponentsstd::powis, as the other answers say, the solution.