Changeset 9490


Ignore:
Timestamp:
Nov 7, 2009, 10:57:37 PM (12 years ago)
Author:
livings124
Message:

use pow() instead of powf()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/NSStringAdditions.m

    r9413 r9490  
    5454    if (size < pow(1024, 2))
    5555    {
    56         convertedSize = size / 1024.0f;
     56        convertedSize = size / 1024.0;
    5757        unit = NSLocalizedString(@"KB", "File size - kilobytes");
    5858    }
    5959    else if (size < pow(1024, 3))
    6060    {
    61         convertedSize = size / powf(1024.0f, 2.0f);
     61        convertedSize = size / (CGFloat)pow(1024, 2);
    6262        unit = NSLocalizedString(@"MB", "File size - megabytes");
    6363    }
    6464    else if (size < pow(1024, 4))
    6565    {
    66         convertedSize = size / powf(1024.0f, 3.0f);
     66        convertedSize = size / (CGFloat)pow(1024, 3);
    6767        unit = NSLocalizedString(@"GB", "File size - gigabytes");
    6868    }
    6969    else
    7070    {
    71         convertedSize = size / powf(1024.0f, 4.0f);
     71        convertedSize = size / (CGFloat)pow(1024, 4);
    7272        unit = NSLocalizedString(@"TB", "File size - terabytes");
    7373    }
    7474   
    7575    //attempt to have minimum of 3 digits with at least 1 decimal
    76     return convertedSize <= 9.995f ? [NSString localizedStringWithFormat: @"%.2f %@", convertedSize, unit]
     76    return convertedSize <= 9.995 ? [NSString localizedStringWithFormat: @"%.2f %@", convertedSize, unit]
    7777                                : [NSString localizedStringWithFormat: @"%.1f %@", convertedSize, unit];
    7878}
Note: See TracChangeset for help on using the changeset viewer.