Is it a bug? Unary operator.
Posted: 2012-12-22T11:18:22-07:00
Hi, I've discovered something strange. The documentation reads:
Should it always be 0.01?
Older version works OK:
JaZ
Thats is reasonable. But what happens when the unary operator is on the right?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).
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
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