Compile[{{x, _Real, 1}}, MemberQ[x, 2]][{2}]
outputs False
.
In fact, it seems to get compiled as False
for every input if you look at a CompilePrint
. It doesn't call the main evaluator, and MemberQ
is included in the Compile`CompilerFunctions[]
list
Any ideas?
Compile[{{x, _Integer, 1}}, MemberQ[x, 2]]
works;Compile[{{x, _Real, 1}}, MemberQ[x, 2.]]
also works.MemberQ[{2.}, 2]
might help you figure out why. $\endgroup$ – J. M.'s ennui♦ May 23 '12 at 5:15