RuntimeOptions

RuntimeOptions
is an option for Compile that specifies runtime settings for the compiled function it creates.

DetailsDetails

  • RuntimeOptions applies to the execution of the compiled function.
  • RuntimeOptions can take the following overall settings:
  • "Quality"optimize for quality of final results
    "Speed"optimize for speed of getting results
  • RuntimeOptions can also take the following nested settings:
  • "CatchMachineOverflow"Falsewhether real overflow should be caught as it happens
    "CatchMachineUnderflow"Falsewhether real underflow should be caught as it happens
    "CatchMachineIntegerOverflow"Truewhether integer overflow should be caught
    "CompareWithTolerance"Truewhether comparisons should work similarly to SameQ
    "EvaluateSymbolically"Truewhether to evaluate with symbolic arguments
    "RuntimeErrorHandler"Evaluatea function to apply if there is a fatal runtime error executing the function
    "WarningMessages"Truewhether warning messages should be emitted
  • RuntimeOptions->"Speed" is equivalent to the following nested settings:
  • "CatchMachineOverflow"False
    "CatchMachineUnderflow"False
    "CatchMachineIntegerOverflow"False
    "CompareWithTolerance"False
    "EvaluateSymbolically"True
    "RuntimeErrorHandler"Evaluate
    "WarningMessages"True
  • RuntimeOptions->"Quality" is equivalent to the following nested settings:
  • "CatchMachineOverflow"True
    "CatchMachineUnderflow"True
    "CatchMachineIntegerOverflow"True
    "CompareWithTolerance"True
    "EvaluateSymbolically"True
    "RuntimeErrorHandler"Evaluate
    "WarningMessages"True

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Typically, integer arithmetic overflow is caught and the computation switches to use bignums:

In[1]:=
Click for copyable input
Out[1]=

Turning off runtime checks leads to maximum speed but the result can be incorrect if the numbers overflow:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 2010
(8.0)