Page 1 of 1

potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T10:48:04-07:00
by fmw42
IM 6.4.3-6 Q16 Mac OSX Tiger

The recently added log2 function to fx does not seem to work:

convert rose: -format "%[fx:log(w)]" info:
1.8451

convert rose: -format "%[fx:ln(w)]" info:
4.2485

convert rose: -format "%[fx:log2(w)]" info:

convert: missing expression `'.

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T11:18:06-07:00
by magick
Sigh. The crappy parser thinks of log2 as log*2. Come up with a name for log2() that does not have a number in it and we will apply a patch to the Subversion trunk (e.g. logdeux() works).

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T11:38:27-07:00
by el_supremo
How about logbin() or logbinary() ?

Pete

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T12:02:31-07:00
by fmw42
magick wrote:Sigh. The crappy parser thinks of log2 as log*2. Come up with a name for log2() that does not have a number in it and we will apply a patch to the Subversion trunk (e.g. logdeux() works).
How about logtwo()?

From Wikipedia:
binary logarithm (log2; sometimes lg, lb, or ld), in computer science and information theory

So other suggestions are: logb or lb (don't really like that) or ( logbin per el_supremo )

My preference, I guess, would be either logb() or logtwo(), but I can live with logbin() also (but logb is shorter)

el_supremo, Anthony or any one else - do you have a preference from any of these?

By the way, there is a workaround so this is not urgent:

log2(x) = log(x)/log(2)


FYI: the reason this came up to begin with was in response to viewtopic.php?f=1&t=11979

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T12:20:21-07:00
by magick
We changed it to logtwo() for now. If you have another preference, let us know.

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T12:36:12-07:00
by fmw42
magick wrote:We changed it to logtwo() for now. If you have another preference, let us know.

That is fine with me. If others have a preference, let them speak out quickly.

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T14:48:16-07:00
by el_supremo
No problemo

Pete

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T17:04:52-07:00
by anthony
I would not worry about a log2() or logtwo()
better to use log(number)/log(base) in any case!
the base being a constant if you want it in a loop!

It is basically how log2 and log10 work in any case.

Re: potential bug in fx log2 IM 6.4.3-6

Posted: 2008-09-03T17:16:16-07:00
by fmw42
anthony wrote:I would not worry about a log2() or logtwo()
better to use log(number)/log(base) in any case!
the base being a constant if you want it in a loop!

It is basically how log2 and log10 work in any case.

That is how I am already doing it now (as a workaround). But Magick had built a log2() function in -fx (to make things cleaner/simpler) and this is just a fix of the name as having a numeral in the log2() name caused problems. See my earlier post.