Usually, when we want to check fractional numbers for equality, we do this with some uncertainty due to the approximate nature of IEEE754.
if (fabs(one_float - other_float) < SUFFICIENTLY_SMALL) {
consider them equal;
}
Another approach may be to distinguish floats with integers of a certain size and instead compare the resulting integers.
if ((uint)one_float == (uint)other_float) {
consider them equal;
}
But consider the situation when our floats are never subjected to any arithmetic, and the only thing we do with them is the purpose.
void resize(float new_width, float new_height)
{
if (current_width == new_width && current_height == new_height) {
return;
}
accomodate framebuffers;
update uniforms;
do stuff;
current_width = new_width;
current_height = new_height;
}
, , . , , . , , , ; . , . x86 ARM , . , ?
, -, float ? ?