Are Float and int values are equal?

Float y=3.0 and Int x=3 are equal or not? in c++ eual then how?


6/16/2019 2:51:04 PM

imtiaz Ahmad

7 Answers

New Answer


Should be able to compare with the == operator. Quick google search shows the int is converted to floating point, meaning that the numbers may not be perfectly equal when comparing them, but typically are.




You can test it using ==


already deleted it was a mistake


No it's not in c++


one can say thats equal but not equal by general due to floating decimal values also in casting problems they are different


Thanks all for valuable answers 👍