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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]