In NSURLSession, when my file is downloading I keep track of the progress with:
CGFloat progress = (CGFloat)totalBytesWritten / (CGFloat)totalBytesExpectedToWrite;
To update an on-screen indicator. I need to make sure once the download is complete though that the indicator disappears, as in my case I show the image being downloaded.
Is if (progress == 1.0) { ... }
okay as a check? It may seem silly but I want to make sure there's no edge cases I'm failing to consider, as in the past I've been bit by weird division results with programming, maybe it will return 1.000000
or 1.0000001828111
or something, or could it even do something like 0.99999999999999999
?