Function get_digits(): Return 1 when input number is 0
git-svn-id: https://svn.code.sf.net/p/porg/code/trunk@186 8854956c-c02d-4db9-8198-7e99b8e08f37
This commit is contained in:
parent
025430a562
commit
f355e83c98
|
@ -1,3 +1,9 @@
|
|||
SVN
|
||||
---
|
||||
|
||||
+ porg: Function get_digits(): Return 1 when input number is 0.
|
||||
|
||||
|
||||
Version 0.10 (17 May 2016)
|
||||
--------------------------
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ static int get_digits(ulong n)
|
|||
{
|
||||
int ret;
|
||||
for (ret = 0; n; n /= 10, ret++) ;
|
||||
return ret;
|
||||
return max(1, ret);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue