Page 1 of 1

Is it a bug? Unary operator.

Posted: 2012-12-22T11:18:22-07:00
by jaz99
Hi, I've discovered something strange. The documentation reads:
Unary operators have a lower priority than binary operators, that is, the unary minus (negation) has lower precedence than exponentiation, so -3^2 is interpreted as -(3^2) = -9. Use parentheses to clarify your intent (e.g. (-3)^2 = 9).
Thats is reasonable. But what happens when the unary operator is on the right?

Code: Select all

$ convert -version
Version: ImageMagick 6.8.0-8 2012-12-11 Q16 http://www.imagemagick.org
$ convert xc: -format '%[fx: 10^-2]' info:
0.2
$ convert xc: -format '%[fx: 10^(-2)]' info:
0.01
Should it always be 0.01?

Older version works OK:

Code: Select all

$ convert -version
Version: ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org
$ convert xc: -format '%[fx: 10^-2]' info:
0.01
JaZ

Re: Is it a bug? Unary operator.

Posted: 2012-12-22T14:58:11-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.1-2 Beta available by sometime tomorrow. Thanks.