Changeset 5542


Ignore:
Timestamp:
Apr 6, 2008, 2:59:37 PM (14 years ago)
Author:
livings124
Message:

fix ratio showing as -0.01

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/NSStringAdditions.m

    r5541 r5542  
    2525#import "NSStringAdditions.h"
    2626#import <transmission.h>
     27
     28#warning better rounding
    2729
    2830@implementation NSString (NSStringAdditions)
     
    9799   
    98100    if (ratio < 10.0)
    99         return [NSString localizedStringWithFormat: @"%.2f", ratio];
     101        return [NSString localizedStringWithFormat: @"%.2f", MAX(0.0, ratio - .005)];
    100102    else if (ratio < 100.0)
    101         return [NSString localizedStringWithFormat: @"%.1f", ratio];
     103        return [NSString localizedStringWithFormat: @"%.1f", ratio - .05];
    102104    else
    103105        return [NSString localizedStringWithFormat: @"%.0f", ratio];
Note: See TracChangeset for help on using the changeset viewer.