From d9ff2d6105f91516892fda55f70cb875ad599042 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 6 Apr 2008 14:59:37 +0000 Subject: [PATCH] fix ratio showing as -0.01 --- macosx/NSStringAdditions.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macosx/NSStringAdditions.m b/macosx/NSStringAdditions.m index 107d5f04f..152b1b210 100644 --- a/macosx/NSStringAdditions.m +++ b/macosx/NSStringAdditions.m @@ -25,6 +25,8 @@ #import "NSStringAdditions.h" #import +#warning better rounding + @implementation NSString (NSStringAdditions) + (NSString *) ellipsis @@ -96,9 +98,9 @@ else; if (ratio < 10.0) - return [NSString localizedStringWithFormat: @"%.2f", ratio]; + return [NSString localizedStringWithFormat: @"%.2f", MAX(0.0, ratio - .005)]; else if (ratio < 100.0) - return [NSString localizedStringWithFormat: @"%.1f", ratio]; + return [NSString localizedStringWithFormat: @"%.1f", ratio - .05]; else return [NSString localizedStringWithFormat: @"%.0f", ratio]; }