About this task
IBM® Rational® Rhapsody® provides
the following macros for converting to/from fixed-point variables:
- FXP2INT(FPvalue, FPshift) - Converts
a fixed-point variable to an integer
- FXP2DOUBLE(FPvalue,
FPshift) -
Converts a fixed-point variable to a double
- DOUBLE2FXP(Dvalue,
FPshift) -
Converts a double to a fixed-point variable
These
macros can be used with the macros that
require fixed-point variables as arguments, for example:
FXP_ASSIGN_EXT(myFixedPointVar, FXP_16Bit_T, 4, DOUBLE2FXP(3.5, 1), 1);
The arguments provided represent:
- Fixed-point variable to be initialized
- FXP type of the variable to be initialized
- FXP shift of the variable to be initialized
- Initializing value in integer representation
- Shift of the integer initializing number