Keep in mind the following points when working with fixed-point
variables:
- The supported operations can only be performed
on fixed-point variables, and not on the result of fixed-point calculations.
For example, these operations are not permitted: FXP_ASSIGN_SUM(FXP_ASSIGN_SUM(varA,varB),varC).
- Operations can be performed on fixed-point variables
only. If you try to use one of the operations with a combination of
fixed-point and ordinary variables, compilation errors will result.
- The shift specified can range from 0 to (word size
- 1). IBM® Rational® Rhapsody® does
not check that the shift you entered for the variable is within this
range.
- When calling a function that takes a fixed-point
variable as an argument, make sure that the variable provided to the
function has the same fixed-point characteristics (word size and shift)
as the defined argument.
- When calling a function that returns a fixed-point
variable, make sure that the return value is being assigned to a variable
that has the same fixed-point characteristics (word size and shift)
as the defined return type.
- Programmers must take into account that operations
on fixed-point variables can result in an arithmetic overflow.
- Programmers must take into account that operations
on fixed-point variables can result in a loss of precision.