I'm making a calculation on the progress a download has, but can't seem to cast to a float. The progress is indicated by a float between 0 and 1. The current unsigned longs that are coming in are:
totalBytesWritten = 6043903
totalBytesExpectedToWrite = 11545769
To get a number between 0 and 1 I perform the calculation:
6043903/11545769
This expected result is: 0,523473404 BUT the given result is 0.000000
Below the function where I try to calculate the progress:
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
NSLog(@"%qi/%qi = %f", totalBytesWritten, totalBytesExpectedToWrite, (float)(totalBytesWritten/totalBytesExpectedToWrite));
}
Anyone knows how to get my calculation right?