From 03a23cf797bab9b6ce8ad7e2c246046027cfcd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C5=93ur?= Date: Thu, 2 Mar 2023 01:33:17 +0800 Subject: [PATCH] fix: max 4 significant digits for speed (#5100) --- macosx/NSStringAdditions.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macosx/NSStringAdditions.mm b/macosx/NSStringAdditions.mm index fb715d1c9..b1f0ae008 100644 --- a/macosx/NSStringAdditions.mm +++ b/macosx/NSStringAdditions.mm @@ -160,24 +160,24 @@ + (NSString*)stringForSpeed:(CGFloat)speed kb:(NSString*)kb mb:(NSString*)mb gb:(NSString*)gb { - if (speed <= 999.95) //0.0 KB/s to 999.9 KB/s + if (speed < 999.95) // 0.0 KB/s to 999.9 KB/s { return [NSString localizedStringWithFormat:@"%.1f %@", speed, kb]; } speed /= 1000.0; - if (speed <= 99.995) //1.00 MB/s to 99.99 MB/s + if (speed < 99.995) // 1.00 MB/s to 99.99 MB/s { return [NSString localizedStringWithFormat:@"%.2f %@", speed, mb]; } - else if (speed <= 999.95) //100.0 MB/s to 999.9 MB/s + else if (speed < 999.95) // 100.0 MB/s to 999.9 MB/s { return [NSString localizedStringWithFormat:@"%.1f %@", speed, mb]; } - else //insane speeds + else // insane speeds { - return [NSString localizedStringWithFormat:@"%.2f %@", (speed / 1000.0), gb]; + return [NSString localizedStringWithFormat:@"%.2f %@", speed / 1000.0, gb]; } }