Page 1 of 1

[RESOLED] Possible bugs fx trig functions

Posted: 2018-04-19T17:58:31-07:00
by fmw42
It would seem that in IM 6.9.9.40 and 7.0.7.28 (Mac OSX Sierra) that arcsin and arccos are reversed.

y=0
convert xc: -format "%[fx:acos(y)]\n" info:
0
convert xc: -format "%[fx:asin(y)]\n" info:
1.5708 = pi/2


y=0
magick xc: -format "%[fx:acos(y)]\n" info:
0
magick xc: -format "%[fx:asin(y)]\n" info:
1.5708 = pi/2

But properly arcos(0) is pi/2 and arcsin(0) is 0

See wikipedia graphs at https://en.wikipedia.org/wiki/Inverse_t ... _functions

The above is also obvious since we know that sin(0)=0, so arcsin(0) = 0. And we know that cos(pi/2)=0, so that arccos(0)=pi/2


Checking: the sin(0) should be 0 and the cos(0) should be 1. But in fx, I get

y=0
convert xc: -format "%[fx:sin(y)]\n" info:
0.841471
convert xc: -format "%[fx:cos(y)]\n" info:
0.540302

which are nonsense values.. Likewise for IM 7 with magick.

Re: Possible bugs fx trig functions

Posted: 2018-04-19T18:35:26-07:00
by snibgo
Umm, Fred, are you using "acos(y)" etc? Then you are not using the environment variable $y.

I get the correct results with v7.0.6-28, pre-built binary on Windows 8.1:

Code: Select all

f:\web\im>%IMG7%magick xc: -format "%[fx:acos(0)]\n" info:
1.5708

f:\web\im>%IMG7%magick xc: -format "%[fx:asin(0)]\n" info:
0

f:\web\im>%IMG7%magick convert xc: -format "%[fx:acos(0)]\n" info:
1.5708

f:\web\im>%IMG7%magick convert xc: -format "%[fx:sin(0)]\n" info:
0

Re: Possible bugs fx trig functions

Posted: 2018-04-19T18:47:11-07:00
by fmw42
DOH! :oops: Staring at that for hours and missed it.

Thanks.