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 `'.
potential bug in fx log2 IM 6.4.3-6
Re: potential bug in fx log2 IM 6.4.3-6
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).
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: potential bug in fx log2 IM 6.4.3-6
How about logbin() or logbinary() ?
Pete
Pete
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: potential bug in fx log2 IM 6.4.3-6
How about logtwo()?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).
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
We changed it to logtwo() for now. If you have another preference, let us know.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: potential bug in fx log2 IM 6.4.3-6
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.
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: potential bug in fx log2 IM 6.4.3-6
No problemo
Pete
Pete
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: potential bug in fx log2 IM 6.4.3-6
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: potential bug in fx log2 IM 6.4.3-6
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.