The safe check using the result of the floating point division would be something like:
if (progress > (1.0f - FLT_EPSILON))
However, assuming the numbers of bytes are integers, you can simply check:
if (totalBytesWritten == totalBytesExpectedToWrite)
edit: If, as per comments, you cannot pass the integers on to wherever you need to do this check, you could also ensure that progress
equals 1.0f
in that case:
progress = (written < expected) ? ((CGFloat)written / expected) : 1.0f;