Follow-up from "Resolve "Follow-up from "Add Memory Status to RenterGET and siac renter -v"""
The following discussions from !4745 (merged) should be addressed:
-
@m-cat started a discussion: f/u: I don't think it's possible for the first digit to be anything other than
1
, so this would be more clear:return fmt.Sprintf("1 %s", sizes[i-1].unit)
-
@m-cat started a discussion: (+1 comment) f/u: Was playing around with this locally and added some more test cases, don't think there's any harm in adding them especially since e.g. testing three digits before the decimal wasn't tested.
{12340, "12.34 KB"}, {123400, "123.4 KB"}, {1234000, "1.234 MB"}, {500000, "500 KB"}, {900000, "900 KB"}, {998999, "999 KB"}, {999001, "999 KB"}, {999998, "1 MB"}, // Should round up to 1MB