Can any explain why the below program is giving false as output,
#include<iostream>
using namespace std;
int main(){
float a = 1.52;
double b = 1.52;
if(a == b){
cout << "True\n";
}else{
cout << "False\n";
}
return 0;
}
Both has the same value still the output is false. I understand that 7 decimal bit are available for float and 15 decimal bit are there for double. But we assign the same value for both the variables.
Thanks.
Aucun commentaire:
Enregistrer un commentaire