From: Yi, EungJun Date: Mon, 14 Jul 2014 00:42:49 GMT Subject: Re: [PATCH v3] http: Add Accept-Language header if possible Message-ID: In-Reply-To: 2014-07-14 1:57 GMT+09:00 Junio C Hamano : > > If you do not want floating point (and I think we tend to avoid it > when we do not need it), you can realize that in your use of "0.1" > and "0.01" and "0.001" there is nothing fundamentally floating-point; > you can measure how many digits below the two-byte string zero-dot > you would want upfront (by counting num_langs), and show an integer > counter zero-padded to the left to that width. > > That would avoid having to even worry about a possible funny case > where subtracting 0.01 ten times from 0.1 may not yield zero (or the > result of subtracting nine times may not reach 0.01) due to rounding > errors accumulating, which was the first thing that came to my mind > when I saw your loop. You're right; We don't need floating point numbers. I'll try to fix it.