See the following code:
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemFreeSize];
float totalSpaceInMB = (([fileSystemSizeInBytes longLongValue] /1024.0)/1024.0);
Here totalSpaceInMB
is always rounded off to 1 decimal place.
For example, if fileSystemSizeInBytes = 13261987840
, then totalSpaceInMB = 12647.6
I want 4 decimal places, totalSpaceInMB = 12647.6172
. Why is this happening?
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemFreeSize];
double totalSpaceInMB = (([fileSystemSizeInBytes longLongValue] /1024.0)/1024.0);
NSLog(@"%.4f",totalSpaceInMB);
Hope this helps :)