Groups | Search | Server Info | Login | Register


Groups > comp.soft-sys.math.mathematica > #16937

Compiler output type

From "Harvey P. Dale" <hpd@hpdale.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Compiler output type
Date 2014-05-12 04:43 +0000
Message-ID <lkpjh9$lkk$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


	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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Compiler output type "Harvey P. Dale" <hpd@hpdale.org> - 2014-05-12 04:43 +0000

csiph-web