A compiler (or interpreter) detects source language instructions
performing arithmetic operations using a fixed point format (preferably
packed decimal). Where the operation can be performed without loss of
precision or violation of other constraints of the source language, the
compiler automatically converts the operands to a floating point format
(preferably Decimal Floating Point (DFP)) having hardware support, and
re-converts results to the original fixed point format. Preferably, the
compiler may combine multiple operations and instructions in an
expression tree, analyze the tree, and selectively convert where
possible. The compiler preferably performs a heuristic cost judgment in
determining whether to use a particular conversion.