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

Re: [PATCH] fix potential infinite loop given large unsigned integer

From: Ryan Flynn <hidden>
Date: 2016-06-15 22:47:13

Possibly related (same subject, not in this thread)

On Mon, Aug 10, 2009 at 8:24 AM, Johannes
Schindelin[off-list ref] wrote:
Hi,

On Mon, 10 Aug 2009, Erik Faye-Lund wrote:
quoted
On Mon, Aug 10, 2009 at 7:24 AM, Christian
Couder[off-list ref] wrote:
quoted
quoted
log10() appears to be C99, but can be emulated on earlier C-versions by
doing #define log10(x) (log(x) / log(10.0))
That would mean linking with -lm?
I guess so. Are we currently trying to avoid linking to the math-parts
of libc?
Yes.

I guess we could fix the overflow thing very easily, though:

static unsigned int digits_of_number(unsigned int number) {
       unsigned int result;
       for (result = 1; number; number /= 10, result++)
               ; /* do nothing */
       return result;
}

Ciao,
Dscho
that is equivalent to the original patch, yes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help