Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] blame: avoid -lm by not using log().

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:21

Hi,

On Sun, 5 Mar 2006, Junio C Hamano wrote:
-	max_digits = 1 + log(num_blame_lines+1)/log(10);
+	for (max_digits = 1, i = 10; i <= num_blame_lines; max_digits++)
+		i *= 10;
According to my late-night maths skills, these two methods do not do the 
same thing: if num_blame_lines == 9, the log method assigns 2 to 
max_digits, but the for loop stops at max_digits == 1. A trivial fix would 
be to test for i <= num_blame_lines + 1.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help