I got stuck with a problem that looked pretty easy but i cant make it work.
I’m making a simple download manager for OSX using objective C. As part of the app im trying to calculate the percentage of the current download. im trying to use this code but it wont work for me
long double precent = (bytesDownloaded/downloadSize) * 100;
NSLog(@"precnt %Lf",precent);
NSLog(@"Downloadedbyret: %lld", bytesDownloaded);
The bytesDownloaded and downloadSize are long long.
Can someone please advise,
thanks
To get the correct answer, you must cast the values to long double.