Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2014

[Date Index] [Thread Index] [Author Index]

Search the Archive

Compiler output type

  • To: mathgroup at
  • Subject: [mg132714] Compiler output type
  • From: "Harvey P. Dale" <hpd at>
  • Date: Mon, 12 May 2014 00:43:03 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

	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.




  • Prev by Date: Cirlce in 3D?
  • Next by Date: Re: DSolve test
  • Previous by thread: Re: Cirlce in 3D?
  • Next by thread: Re: Compiler output type