Page 1 of 1

Documentation Error on -fx

Posted: 2007-09-09T17:56:57-07:00
by fmw42
On your page http://www.imagemagick.org/script/fx.php, you state regarding the ternary operator:

x ? y : z: ternary conditional expression, returns value y if x > 0, otherwise z; only one ternary conditional permitted per statement

However this does not work. The statement reads that -fx will test to see if x is positive. I have tried using -fx "(abs(u-v) - .01)?v:u" and I always get v for the result. I consulted with Anthony Thyssen and he tells me to use -fx "(abs(u-v) > .01)?v:u". That is x must be a test, not a value!

I think you need to rephrase your discussion of the ternary condition in your documentation to make this more clear. Something like

x>0 ? y : z: ternary conditional expression, returns value y if x > 0, otherwise z; only one ternary conditional permitted per statement

Thanks.

Fred Weinhaus

Re: Documentation Error on -fx

Posted: 2007-09-09T18:39:57-07:00
by magick
The correct interpretation should be if the expression != 0 then y otherwise z. We will correct the documentation and verify its working properly (and if not apply a patch) for the upcoming ImageMagick 6.3.5-9 release.

Re: Documentation Error on -fx

Posted: 2007-10-02T00:09:22-07:00
by anthony
Just uploaded a minor fix to make it a floating point test for zero