- Joined
- Jan 11, 2023
- Messages
- 8
- Reaction score
- 0
Code:
int highest = 5;
int lowest = 3;
std::cout << "((float)highest/(float)lowest) = " << ((float)highest/(float)lowest) << "\n";
std::cout << "(5.0/3.0) = " << (5.0/3.0) << "\n";
std::cout << "(((float)highest/(float)lowest) == (5.0/3.0)) = "
<< (((float)highest/(float)lowest) == (5.0/3.0)) << "\n";
output:
Code:
((float)highest/(float)lowest) = 1.66667
(5.0/3.0) = 1.66667
(((float)highest/(float)lowest) == (5.0/3.0)) = 0
why does (5/3) not equal (5/3)?