0

why 0? c++

#include <iostream> using namespace std; int main() { double a = 0.1, b=0.2,c=0.3; cout<<((a+b)==c); return 0; }

3rd Apr 2024, 2:06 PM
technocat
technocat - avatar
4 Respostas
3rd Apr 2024, 2:10 PM
Lisa
Lisa - avatar
+ 3
This is described in the link that I provided.
3rd Apr 2024, 2:23 PM
Lisa
Lisa - avatar
0
so how to compare floats?
3rd Apr 2024, 2:15 PM
technocat
technocat - avatar
0
You can compare floats only up to a predefined precision. That precision is up to you and the requirements of your program.
3rd Apr 2024, 4:06 PM
Gordie
Gordie - avatar