f



Compiler output type

	Some compiled functions yield reals even if the input and necessary output are integers.  How can I force the output to be an integer rather than a real in such cases?  To be clear, not all compiled program output produces reals; some compiled programs, given integer inputs, produce integer outputs.  But some do not.  An example is:

collatz = Compile[{{n, _Integer}}, If[EvenQ[n], n/2, 3 n + 1]]

It produces real rather than integer output, and I'd like to force integer output if possible.

	Thanks

	Best,

	Harvey

0
Harvey
5/12/2014 4:43:21 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

0 Replies
1433 Views

Similar Articles

[PageSpeed] 6

Reply: